# HG changeset patch # User Chris Cannam # Date 1196444174 0 # Node ID 35e438b612ffa6023d89d62c247ce60f35afa41d # Parent 0ebfc1e392f1c397d29f00921ba2faf1f649df53 * Merge r884 from trunk diff -r 0ebfc1e392f1 -r 35e438b612ff main/main.cpp --- a/main/main.cpp Thu Nov 29 12:02:09 2007 +0000 +++ b/main/main.cpp Fri Nov 30 17:36:14 2007 +0000 @@ -266,8 +266,8 @@ qRegisterMetaType("size_t"); qRegisterMetaType("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; }