diff options
author | Mnikolenko Productengine <mnikolenko@productengine.com> | 2017-06-09 18:16:58 +0300 |
---|---|---|
committer | Mnikolenko Productengine <mnikolenko@productengine.com> | 2017-06-09 18:16:58 +0300 |
commit | 5e905cf80d472c433875452a2baaa179ceb0fe71 (patch) | |
tree | 05d3dd1c9b4b33e77329c146df125d4ac1e3abc0 | |
parent | 2b6ab45210113950ea575ef62280c15fad30ff96 (diff) |
MAINT-7477 FIXED [viewer-neko] Viewer crashes when saving snapshot to disk and closing file picker window
-rw-r--r-- | indra/newview/llsnapshotlivepreview.cpp | 7 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llviewerwindow.h | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index c6f8c414fa..ee8b2d79c0 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -1080,12 +1080,13 @@ BOOL LLSnapshotLivePreview::saveLocal() return success; } -//Check if failed due to insuficient memory +//Check if failed due to insufficient memory BOOL LLSnapshotLivePreview::saveLocal(LLPointer<LLImageFormatted> mFormattedImage) { - BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage); + BOOL insufficient_memory; + BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage, FALSE, insufficient_memory); - if (!success) + if (insufficient_memory) { std::string lastSnapshotDir = LLViewerWindow::getLastSnapshotDir(); diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 45ea0f8e02..a2c5fa2630 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4354,8 +4354,10 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d } // Saves an image to the harddrive as "SnapshotX" where X >= 1. -BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker) +BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picker, BOOL& insufficient_memory) { + insufficient_memory = FALSE; + if (!image) { LL_WARNS() << "No image to save" << LL_ENDL; @@ -4407,6 +4409,7 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picke #endif if (b_space.free < image->getDataSize()) { + insufficient_memory = TRUE; return FALSE; } // Look for an unused file name diff --git a/indra/newview/llviewerwindow.h b/indra/newview/llviewerwindow.h index 5d7076178a..38178fa910 100644 --- a/indra/newview/llviewerwindow.h +++ b/indra/newview/llviewerwindow.h @@ -352,7 +352,7 @@ public: BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, LLSnapshotModel::ESnapshotLayerType type); BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); } void resetSnapshotLoc() const { sSnapshotDir.clear(); } - BOOL saveImageNumbered(LLImageFormatted *image, bool force_picker = false); + BOOL saveImageNumbered(LLImageFormatted *image, BOOL force_picker, BOOL& insufficient_memory); // Reset the directory where snapshots are saved. // Client will open directory picker on next snapshot save. |