diff main/main.cpp @ 637:f45af8d8091e imaf_enc

Merge from default branch
author Chris Cannam
date Mon, 04 Nov 2013 17:47:53 +0000
parents c0a20cd1a9ff
children 763b1fbeb31c 6d8a76bd91a7
line wrap: on
line diff
--- a/main/main.cpp	Mon Nov 04 17:17:09 2013 +0000
+++ b/main/main.cpp	Mon Nov 04 17:47:53 2013 +0000
@@ -172,16 +172,21 @@
 */
 
 static QMutex cleanupMutex;
+static bool cleanedUp = false;
 
 static void
 signalHandler(int /* signal */)
 {
     // Avoid this happening more than once across threads
 
+    std::cerr << "signalHandler: cleaning up and exiting" << std::endl;
     cleanupMutex.lock();
-    std::cerr << "signalHandler: cleaning up and exiting" << std::endl;
-    TempDirectory::getInstance()->cleanup();
-    exit(0); // without releasing mutex
+    if (!cleanedUp) {
+        TempDirectory::getInstance()->cleanup();
+        cleanedUp = true;
+    }
+    cleanupMutex.unlock();
+    exit(0);
 }
 
 class SVApplication : public QApplication
@@ -358,14 +363,21 @@
     if (width > height * 2) width = height * 2;
 
     settings.beginGroup("MainWindow");
+
     QSize size = settings.value("size", QSize(width, height)).toSize();
     gui->resizeConstrained(size);
+
     if (settings.contains("position")) {
         QRect prevrect(settings.value("position").toPoint(), size);
         if (!(available & prevrect).isEmpty()) {
             gui->move(prevrect.topLeft());
         }
     }
+
+    if (settings.value("maximised", false).toBool()) {
+        gui->setWindowState(Qt::WindowMaximized);
+    }
+
     settings.endGroup();
     
     gui->show();
@@ -422,8 +434,12 @@
 
     cleanupMutex.lock();
 
-    TransformFactory::deleteInstance();
-    TempDirectory::getInstance()->cleanup();
+    if (!cleanedUp) {
+        TransformFactory::deleteInstance();
+        TempDirectory::getInstance()->cleanup();
+        cleanedUp = true;
+    }
+
     application.releaseMainWindow();
 
 #ifdef HAVE_FFTW3F
@@ -473,6 +489,10 @@
 
     MainWindow::FileOpenStatus status = MainWindow::FileOpenFailed;
 
+#ifdef Q_OS_WIN32
+    path.replace("\\", "/");
+#endif
+
     if (path.endsWith("sv")) {
         if (!haveSession) {
             status = m_mainWindow->openSessionFile(path);