Qt: Fix deadlock while telling GL thread to stop

This commit is contained in:
Jeffrey Pfau 2014-11-09 16:36:36 -08:00
parent c2564c77a9
commit 6e62ba8bb2
1 changed files with 4 additions and 0 deletions

View File

@ -52,9 +52,13 @@ void Display::startDrawing(const uint32_t* buffer, GBAThread* thread) {
void Display::stopDrawing() {
if (m_drawThread) {
GBAThreadInterrupt(m_context);
GBASyncSuspendDrawing(&m_context->sync);
QMetaObject::invokeMethod(m_painter, "stop", Qt::BlockingQueuedConnection);
m_drawThread->exit();
m_drawThread = nullptr;
GBASyncResumeDrawing(&m_context->sync);
GBAThreadContinue(m_context);
}
}