Qt: Don't attempt to draw a frame if holding an interrupter

This commit is contained in:
Vicki Pfau 2022-06-24 00:39:42 -07:00
parent fa5c5e9601
commit 2700bf2c97
3 changed files with 15 additions and 0 deletions

View File

@ -1358,3 +1358,7 @@ void CoreController::Interrupter::resume(CoreController* controller) {
mCoreThreadContinue(controller->thread());
}
bool CoreController::Interrupter::held() const {
return m_parent && m_parent->thread()->impl;
}

View File

@ -68,6 +68,8 @@ public:
void interrupt(std::shared_ptr<CoreController>);
void resume();
bool held() const;
private:
void interrupt();
void resume(CoreController*);

View File

@ -626,6 +626,15 @@ void PainterGL::draw() {
if (!m_started || m_queue.isEmpty()) {
return;
}
if (m_interrupter.held()) {
// A resize event is pending; that needs to happen first
if (!m_drawTimer.isActive()) {
m_drawTimer.start(0);
}
return;
}
mCoreSync* sync = &m_context->thread()->impl->sync;
if (!mCoreSyncWaitFrameStart(sync)) {
mCoreSyncWaitFrameEnd(sync);