Merge pull request #6587 from jherico/rigel

Fix crashes on exit due to poor cleanup
This commit is contained in:
Brad Hefta-Gaub 2015-12-07 18:04:52 -08:00
commit 4cbbd252d5
3 changed files with 18 additions and 0 deletions

View file

@ -1077,6 +1077,11 @@ void Application::initializeUi() {
}
void Application::paintGL() {
// paintGL uses a queued connection, so we can get messages from the queue even after we've quit
// and the plugins have shutdown
if (_aboutToQuit) {
return;
}
_frameCount++;
// update fps moving average

View file

@ -30,6 +30,12 @@ class PresentThread : public QThread, public Dependency {
using Lock = std::unique_lock<Mutex>;
public:
PresentThread() {
connect(qApp, &QCoreApplication::aboutToQuit, [this]{
_shutdown = true;
});
}
~PresentThread() {
_shutdown = true;
wait();
@ -99,6 +105,10 @@ public:
_context->doneCurrent();
}
_context->makeCurrent();
if (_activePlugin) {
_activePlugin->uncustomizeContext();
}
_context->doneCurrent();
_context->moveToThread(qApp->thread());
}

View file

@ -337,6 +337,9 @@ void OffscreenQmlSurface::create(QOpenGLContext* shareContext) {
// a timer with a small interval is used to get better performance.
_updateTimer.setInterval(MIN_TIMER_MS);
connect(&_updateTimer, &QTimer::timeout, this, &OffscreenQmlSurface::updateQuick);
QObject::connect(qApp, &QCoreApplication::aboutToQuit, [this]{
disconnect(&_updateTimer, &QTimer::timeout, this, &OffscreenQmlSurface::updateQuick);
});
_updateTimer.start();
_qmlComponent = new QQmlComponent(_qmlEngine);