From 4195c7730b81eab3b9a86bac8437b27e4ea0dac1 Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Thu, 6 Apr 2017 11:54:13 -0700 Subject: [PATCH] Qt: Fix crash when changing audio settings after a game is closed --- CHANGES | 1 + src/platform/qt/GameController.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 8613b2b86..39d06cd95 100644 --- a/CHANGES +++ b/CHANGES @@ -18,6 +18,7 @@ Bugfixes: - SDL: Fix game crash check - SDL: Fix race condition with audio thread when starting - FFmpeg: Fix overflow and general issues with audio encoding + - Qt: Fix crash when changing audio settings after a game is closed Misc: - Qt: Improved HiDPI support - Feature: Support ImageMagick 7 diff --git a/src/platform/qt/GameController.cpp b/src/platform/qt/GameController.cpp index 79e37ae0c..caaf9ba35 100644 --- a/src/platform/qt/GameController.cpp +++ b/src/platform/qt/GameController.cpp @@ -592,6 +592,7 @@ void GameController::cleanGame() { delete[] m_frontBuffer; m_threadContext.core->deinit(m_threadContext.core); + m_threadContext.core = nullptr; m_gameOpen = false; } @@ -1158,7 +1159,7 @@ void GameController::updateKeys() { } void GameController::redoSamples(int samples) { - if (m_threadContext.core) { + if (m_gameOpen && m_threadContext.core) { m_threadContext.core->setAudioBufferSize(m_threadContext.core, samples); } QMetaObject::invokeMethod(m_audioProcessor, "inputParametersChanged");