Qt: Disable sync while running scripts from main thread (fixes #2738)

This commit is contained in:
Vicki Pfau 2023-01-27 19:32:27 -08:00
parent f69853e8ba
commit 31755ebb19
2 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@ Emulation fixes:
- GBA Memory: Make VRAM access stalls only apply to BG RAM
Other fixes:
- Qt: Fix crash when attempting to use OpenGL 2.1 to 3.1 (fixes mgba.io/i/2794)
- Qt: Disable sync while running scripts from main thread (fixes mgba.io/i/2738)
Misc:
- Qt: Include wayland QPA in AppImage (fixes mgba.io/i/2796)

View File

@ -5,6 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "scripting/ScriptingController.h"
#include "AudioProcessor.h"
#include "CoreController.h"
#include "scripting/ScriptingTextBuffer.h"
#include "scripting/ScriptingTextBufferModel.h"
@ -73,11 +74,20 @@ bool ScriptingController::load(VFileDevice& vf, const QString& name) {
}
QByteArray utf8 = name.toUtf8();
CoreController::Interrupter interrupter(m_controller);
if (m_controller) {
m_controller->setSync(false);
m_controller->unpaused();
}
bool ok = true;
if (!m_activeEngine->load(m_activeEngine, utf8.constData(), vf) || !m_activeEngine->run(m_activeEngine)) {
emit error(QString::fromUtf8(m_activeEngine->getError(m_activeEngine)));
return false;
ok = false;
}
return true;
if (m_controller && m_controller->isPaused()) {
m_controller->setSync(true);
m_controller->paused();
}
return ok;
}
void ScriptingController::clearController() {