changeset 592:1918bf5c9a9e

Some bits and bobs to do with handling memory pressure
author Chris Cannam
date Mon, 06 Mar 2017 17:23:46 +0000
parents 77d33ed8e753
children 821aba42c1bb
files framework/MainWindowBase.cpp
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Sun Mar 05 17:15:46 2017 +0000
+++ b/framework/MainWindowBase.cpp	Mon Mar 06 17:23:46 2017 +0000
@@ -1409,6 +1409,13 @@
             (this, tr("Not enough disc space"),
              tr("<b>Not enough disc space</b><p>There doesn't appear to be enough spare disc space to accommodate any necessary temporary files.</p><p>Please clear some space and try again.</p>").arg(e.what()));
         return FileOpenFailed;
+    } catch (const std::bad_alloc &e) { // reader may have rethrown this after cleaning up
+        emit hideSplash();
+        m_openingAudioFile = false;
+        QMessageBox::critical
+            (this, tr("Not enough memory"),
+             tr("<b>Not enough memory</b><p>There doesn't appear to be enough memory to accommodate any necessary temporary data.</p>"));
+        return FileOpenFailed;
     }
 }