From: Dan Dennedy Date: Sat, 4 Sep 2010 05:28:48 +0000 (+0000) Subject: Fix hang on exit somewhere strange inside Qt on OS X. X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=9429b50ed8a0e1529cf5736391fd73d2973a8feb;p=kdenlive Fix hang on exit somewhere strange inside Qt on OS X. 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 --- diff --git a/src/main.cpp b/src/main.cpp index 0a02c50e..ad39ecb3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e6d97e99..54c2a03c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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(); }