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() { 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++; _frameCount++;
// update fps moving average // update fps moving average

View file

@ -30,6 +30,12 @@ class PresentThread : public QThread, public Dependency {
using Lock = std::unique_lock<Mutex>; using Lock = std::unique_lock<Mutex>;
public: public:
PresentThread() {
connect(qApp, &QCoreApplication::aboutToQuit, [this]{
_shutdown = true;
});
}
~PresentThread() { ~PresentThread() {
_shutdown = true; _shutdown = true;
wait(); wait();
@ -99,6 +105,10 @@ public:
_context->doneCurrent(); _context->doneCurrent();
} }
_context->makeCurrent();
if (_activePlugin) {
_activePlugin->uncustomizeContext();
}
_context->doneCurrent(); _context->doneCurrent();
_context->moveToThread(qApp->thread()); _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. // a timer with a small interval is used to get better performance.
_updateTimer.setInterval(MIN_TIMER_MS); _updateTimer.setInterval(MIN_TIMER_MS);
connect(&_updateTimer, &QTimer::timeout, this, &OffscreenQmlSurface::updateQuick); connect(&_updateTimer, &QTimer::timeout, this, &OffscreenQmlSurface::updateQuick);
QObject::connect(qApp, &QCoreApplication::aboutToQuit, [this]{
disconnect(&_updateTimer, &QTimer::timeout, this, &OffscreenQmlSurface::updateQuick);
});
_updateTimer.start(); _updateTimer.start();
_qmlComponent = new QQmlComponent(_qmlEngine); _qmlComponent = new QQmlComponent(_qmlEngine);