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()); 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 interrupt(std::shared_ptr<CoreController>);
void resume(); void resume();
bool held() const;
private: private:
void interrupt(); void interrupt();
void resume(CoreController*); void resume(CoreController*);

View File

@ -626,6 +626,15 @@ void PainterGL::draw() {
if (!m_started || m_queue.isEmpty()) { if (!m_started || m_queue.isEmpty()) {
return; 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; mCoreSync* sync = &m_context->thread()->impl->sync;
if (!mCoreSyncWaitFrameStart(sync)) { if (!mCoreSyncWaitFrameStart(sync)) {
mCoreSyncWaitFrameEnd(sync); mCoreSyncWaitFrameEnd(sync);