diff main/main.cpp @ 222:a3011df6ddad

* Skip ID3 block when reading MP3 files (so long as ID3 support is included) * Show progress when retrieving audio file from playlist * Avoid -- but do not actually fix -- segmentation fault on exit. I am totally stumped at the moment about why both the PA and JACK audio targets should crash when properly shut down. For the moment, we just don't shut them down... * Fix incorrect behaviour (introduced on Friday as part of a different fix) when replacing main model in situation where no current main model exists
author Chris Cannam
date Fri, 30 Nov 2007 17:31:09 +0000
parents 79ea249689d9
children e8a7a935128e fc542303eda2
line wrap: on
line diff
--- a/main/main.cpp	Thu Nov 29 10:50:13 2007 +0000
+++ b/main/main.cpp	Fri Nov 30 17:31:09 2007 +0000
@@ -266,8 +266,8 @@
     qRegisterMetaType<size_t>("size_t");
     qRegisterMetaType<PropertyContainer::PropertyName>("PropertyContainer::PropertyName");
 
-    MainWindow gui(audioOutput, oscSupport);
-    application.setMainWindow(&gui);
+    MainWindow *gui = new MainWindow(audioOutput, oscSupport);
+    application.setMainWindow(gui);
 
     QDesktopWidget *desktop = QApplication::desktop();
     QRect available = desktop->availableGeometry();
@@ -280,18 +280,18 @@
     QSettings settings;
     settings.beginGroup("MainWindow");
     QSize size = settings.value("size", QSize(width, height)).toSize();
-    gui.resize(size);
+    gui->resize(size);
     if (settings.contains("position")) {
-        gui.move(settings.value("position").toPoint());
+        gui->move(settings.value("position").toPoint());
     }
     settings.endGroup();
     
-    gui.show();
+    gui->show();
 
     // The MainWindow class seems to have trouble dealing with this if
     // it tries to adapt to this preference before the constructor is
     // complete.  As a lazy hack, apply it explicitly from here
-    gui.preferenceChanged("Property Box Layout");
+    gui->preferenceChanged("Property Box Layout");
 
     bool haveSession = false;
     bool haveMainModel = false;
@@ -308,7 +308,7 @@
 
         if (path.endsWith("sv")) {
             if (!haveSession) {
-                status = gui.openSessionFile(path);
+                status = gui->openSessionFile(path);
                 if (status == MainWindow::FileOpenSucceeded) {
                     haveSession = true;
                     haveMainModel = true;
@@ -320,24 +320,24 @@
         }
         if (status != MainWindow::FileOpenSucceeded) {
             if (!haveMainModel) {
-                status = gui.open(path, MainWindow::ReplaceMainModel);
+                status = gui->open(path, MainWindow::ReplaceMainModel);
                 if (status == MainWindow::FileOpenSucceeded) {
                     haveMainModel = true;
                 }
             } else {
                 if (haveSession && !havePriorCommandLineModel) {
-                    status = gui.open(path, MainWindow::AskUser);
+                    status = gui->open(path, MainWindow::AskUser);
                     if (status == MainWindow::FileOpenSucceeded) {
                         havePriorCommandLineModel = true;
                     }
                 } else {
-                    status = gui.open(path, MainWindow::CreateAdditionalModel);
+                    status = gui->open(path, MainWindow::CreateAdditionalModel);
                 }
             }
         }
         if (status == MainWindow::FileOpenFailed) {
 	    QMessageBox::critical
-                (&gui, QMessageBox::tr("Failed to open file"),
+                (gui, QMessageBox::tr("Failed to open file"),
                  QMessageBox::tr("File or URL \"%1\" could not be opened").arg(path));
         }
     }
@@ -359,10 +359,11 @@
     }
 */
     int rv = application.exec();
-//    std::cerr << "application.exec() returned " << rv << std::endl;
+    std::cerr << "application.exec() returned " << rv << std::endl;
 
     cleanupMutex.lock();
     TempDirectory::getInstance()->cleanup();
+
     application.releaseMainWindow();
 
 #ifdef HAVE_FFTW3F
@@ -375,5 +376,7 @@
     }
 #endif
 
+    delete gui;
+
     return rv;
 }