Qt: Reattach video backend when resetting scripts (fixes #3167)

This commit is contained in:
Vicki Pfau 2024-03-18 23:26:01 -07:00
parent 776d52a2c6
commit c80f3afd77
2 changed files with 3 additions and 0 deletions

View File

@ -92,6 +92,7 @@ void ScriptingController::setInputController(InputController* input) {
} }
void ScriptingController::setVideoBackend(VideoBackend* backend) { void ScriptingController::setVideoBackend(VideoBackend* backend) {
m_videoBackend = backend;
mScriptCanvasUpdateBackend(&m_scriptContext, backend); mScriptCanvasUpdateBackend(&m_scriptContext, backend);
} }
@ -339,6 +340,7 @@ void ScriptingController::init() {
mScriptContextAttachLogger(&m_scriptContext, &m_logger); mScriptContextAttachLogger(&m_scriptContext, &m_logger);
m_bufferModel->attachToContext(&m_scriptContext); m_bufferModel->attachToContext(&m_scriptContext);
mScriptCanvasUpdateBackend(&m_scriptContext, m_videoBackend);
HashTableEnumerate(&m_scriptContext.engines, [](const char* key, void* engine, void* context) { HashTableEnumerate(&m_scriptContext.engines, [](const char* key, void* engine, void* context) {
ScriptingController* self = static_cast<ScriptingController*>(context); ScriptingController* self = static_cast<ScriptingController*>(context);

View File

@ -87,6 +87,7 @@ private:
mScriptEngineContext* m_activeEngine = nullptr; mScriptEngineContext* m_activeEngine = nullptr;
QHash<QString, mScriptEngineContext*> m_engines; QHash<QString, mScriptEngineContext*> m_engines;
ScriptingTextBufferModel* m_bufferModel; ScriptingTextBufferModel* m_bufferModel;
VideoBackend* m_videoBackend = nullptr;
mScriptGamepad m_gamepad; mScriptGamepad m_gamepad;