From be98abc088883410318852226becb7f50f995ab9 Mon Sep 17 00:00:00 2001 From: cg2121 Date: Thu, 11 Aug 2022 05:12:48 -0500 Subject: [PATCH] UI: Fix crash when hiding audio mixer item This crash is suspected to be a QT bug that happens in 6.2.4, as it only happens in this version. This is the QT version that is in the Ubuntu 22.04 ppa, so this fix is a necessary evil as it affects Ubuntu users. This fixes the crash by deferring the hiding of the audio mixer item to the next event loop. --- UI/window-basic-main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/UI/window-basic-main.cpp b/UI/window-basic-main.cpp index ea2af135c..8fc13852e 100644 --- a/UI/window-basic-main.cpp +++ b/UI/window-basic-main.cpp @@ -3294,7 +3294,14 @@ void OBSBasic::HideAudioControl() if (!SourceMixerHidden(source)) { SetSourceMixerHidden(source, true); - DeactivateAudioSource(source); + + /* Due to a bug with QT 6.2.4, the version that's in the Ubuntu + * 22.04 ppa, hiding the audio mixer causes a crash, so defer to + * the next event loop to hide it. Doesn't seem to be a problem + * with newer versions of QT. */ + QMetaObject::invokeMethod(this, "DeactivateAudioSource", + Qt::QueuedConnection, + Q_ARG(OBSSource, OBSSource(source))); } }