diff options
author | Bea Lam <bea.lam@nokia.com> | 2010-06-28 03:53:52 (GMT) |
---|---|---|
committer | Bea Lam <bea.lam@nokia.com> | 2010-06-28 04:44:02 (GMT) |
commit | 2999c11b25b03d39f5abfe0f00607be6d536e3ce (patch) | |
tree | 1501a638ab9852a520d8c55813d1b250ae0194bc /tools | |
parent | 3dae114528ecaed19b8ffca4739ed4e88477554e (diff) | |
download | Qt-2999c11b25b03d39f5abfe0f00607be6d536e3ce.zip Qt-2999c11b25b03d39f5abfe0f00607be6d536e3ce.tar.gz Qt-2999c11b25b03d39f5abfe0f00607be6d536e3ce.tar.bz2 |
Stop QMLLauncher from crashing on exit on Mac when quitting app via the
menu.
This sets the QGraphicsView::viewport() to 0 on exit to avoid
"QGLContext::makeCurrent: Cannot make invalid context current" errors
on exit, and deletes the logger window on exit so it does not receive
error messages after the app is closed.
The QGLContext errors appeared after
6d4e14ef0437ce8f73bddbcb267cf5ef708fbdec.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/qml/qmlruntime.cpp | 12 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h | 2 |
2 files changed, 14 insertions, 0 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 109de7d..e0482cf 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -623,6 +623,8 @@ QDeclarativeViewer::QDeclarativeViewer(QWidget *parent, Qt::WindowFlags flags) autoStopTimer.setRunning(false); recordTimer.setRunning(false); recordTimer.setRepeating(true); + + QObject::connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(appAboutToQuit())); } QDeclarativeViewer::~QDeclarativeViewer() @@ -1277,6 +1279,16 @@ void QDeclarativeViewer::ffmpegFinished(int code) qDebug() << "ffmpeg returned" << code << frame_stream->readAllStandardError(); } +void QDeclarativeViewer::appAboutToQuit() +{ + // avoid QGLContext errors about invalid contexts on exit + canvas->setViewport(0); + + // avoid crashes if messages are received after app has closed + delete loggerWindow; + loggerWindow = 0; +} + void QDeclarativeViewer::autoStartRecording() { setRecording(true); diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index cec3204..92c2969 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -131,6 +131,8 @@ protected: void createMenu(); private slots: + void appAboutToQuit(); + void autoStartRecording(); void autoStopRecording(); void recordFrame(); |