diff --git a/src/steamcompmgr.cpp b/src/steamcompmgr.cpp index f3f2e86..8631f1b 100644 --- a/src/steamcompmgr.cpp +++ b/src/steamcompmgr.cpp @@ -1441,17 +1441,21 @@ paint_all(Display *dpy, MouseCursor *cursor) imageData[y * pitch + x * comp + 3] = 255; } } + pCaptureTexture->nLockRefs--; char pTimeBuffer[1024]; time_t currentTime = time(0); struct tm *localTime = localtime( ¤tTime ); strftime( pTimeBuffer, sizeof( pTimeBuffer ), "/tmp/gamescope_%Y-%m-%d_%H-%M-%S.png", localTime ); - stbi_write_png(pTimeBuffer, currentOutputWidth, currentOutputHeight, 4, imageData.data(), pitch); - - pCaptureTexture->nLockRefs--; - - xwm_log.infof("Screenshot saved to %s", pTimeBuffer); + if ( stbi_write_png(pTimeBuffer, currentOutputWidth, currentOutputHeight, 4, imageData.data(), pitch) ) + { + xwm_log.infof("Screenshot saved to %s", pTimeBuffer); + } + else + { + xwm_log.errorf( "Failed to save screenshot to %s", pTimeBuffer ); + } }); screenshotThread.detach();