]> git.sesse.net Git - kdenlive/commitdiff
Fix hang on exit somewhere strange inside Qt on OS X.
authorDan Dennedy <dan@dennedy.org>
Sat, 4 Sep 2010 05:28:48 +0000 (05:28 +0000)
committerDan Dennedy <dan@dennedy.org>
Sat, 4 Sep 2010 05:28:48 +0000 (05:28 +0000)
This fixes it on OS X, and stil works for me on Linux. Note that
explicitly deleting the window object on Linux causes a crash. By
setting a breakpoint in ~MainWindow, I see that before this change, on
OS X, the dtor is not called. Meanwhile, something in the GUI is likely
still using Qt during/after app.exit() (it was hanging in QtColor, but
the backtrace did not lead back to Kdenlive source). Howevever, on
Linux, without explicitly deleting the window object, the debugger still
stops on the breakpoint inside the dtor! Might this be dependent on Qt
version?

svn path=/trunk/kdenlive/; revision=4833

src/main.cpp
src/mainwindow.cpp

index 0a02c50ebd3880237de50d35b0a2ff830852324e..ad39ecb318f67ca911e25d96b25327f1b6663fda 100644 (file)
@@ -56,6 +56,7 @@ int main(int argc, char *argv[])
     KCmdLineArgs::addCmdLineOptions(options); //new
 
     KApplication app;
+    MainWindow* window = 0;
 
     // see if we are starting with session management
     if (app.isSessionRestored()) {
@@ -63,8 +64,8 @@ int main(int argc, char *argv[])
         while (KMainWindow::canBeRestored(n)) {
             const QString className = KXmlGuiWindow::classNameOfToplevel(n);
             if (className == QLatin1String("MainWindow")) {
-                MainWindow* win = new MainWindow();
-                win->restore(n);
+                window = new MainWindow();
+                window->restore(n);
             } else {
                 kWarning() << "Unknown class " << className << " in session saved data!";
             }
@@ -78,11 +79,15 @@ int main(int argc, char *argv[])
         if (args->count()) {
             url = args->url(0);
         }
-        MainWindow* window = new MainWindow(mltPath, url);
+        window = new MainWindow(mltPath, url);
         window->show();
 
         args->clear();
     }
 
-    return app.exec();
+    int result = app.exec();
+#ifdef Q_WS_MAC
+    delete window;
+#endif
+    return result;
 }
index e6d97e99a1de713884f4a3b6e8aee042cc0de486..54c2a03cad36f2f79731a56303273dbf8f1edf3f 100644 (file)
@@ -483,17 +483,12 @@ MainWindow::~MainWindow()
     if (m_projectMonitor) m_projectMonitor->stop();
     if (m_clipMonitor) m_clipMonitor->stop();
 
-    if (m_activeTimeline) delete m_activeTimeline;
-
+    delete m_activeTimeline;
     delete m_effectStack;
     delete m_transitionConfig;
-
-    if (m_activeDocument) delete m_activeDocument;
-#ifndef Q_WS_MAC
-    // This sometimes causes crash on exit on OS X for some reason.
+    delete m_activeDocument;
     delete m_projectMonitor;
     delete m_clipMonitor;
-#endif
     delete m_shortcutRemoveFocus;
     Mlt::Factory::close();
 }