Qt: Fix printing race conditions

This commit is contained in:
Vicki Pfau 2017-10-10 22:30:28 -07:00
parent 8d9d644dfe
commit 66ce1063d4
1 changed files with 3 additions and 0 deletions

View File

@ -640,6 +640,7 @@ void CoreController::attachPrinter() {
} }
QMetaObject::invokeMethod(qPrinter->parent, "imagePrinted", Q_ARG(const QImage&, image)); QMetaObject::invokeMethod(qPrinter->parent, "imagePrinted", Q_ARG(const QImage&, image));
}; };
Interrupter interrupter(this);
GBSIOSetDriver(&gb->sio, &m_printer.d.d); GBSIOSetDriver(&gb->sio, &m_printer.d.d);
#endif #endif
} }
@ -649,6 +650,7 @@ void CoreController::detachPrinter() {
if (platform() != PLATFORM_GB) { if (platform() != PLATFORM_GB) {
return; return;
} }
Interrupter interrupter(this);
GB* gb = static_cast<GB*>(m_threadContext.core->board); GB* gb = static_cast<GB*>(m_threadContext.core->board);
GBPrinterDonePrinting(&m_printer.d); GBPrinterDonePrinting(&m_printer.d);
GBSIOSetDriver(&gb->sio, nullptr); GBSIOSetDriver(&gb->sio, nullptr);
@ -660,6 +662,7 @@ void CoreController::endPrint() {
if (platform() != PLATFORM_GB) { if (platform() != PLATFORM_GB) {
return; return;
} }
Interrupter interrupter(this);
GBPrinterDonePrinting(&m_printer.d); GBPrinterDonePrinting(&m_printer.d);
#endif #endif
} }