From 2a4a46deedf85bce429311d590c137261f3c5211 Mon Sep 17 00:00:00 2001 From: Richard Stanway Date: Mon, 2 Mar 2020 22:21:02 +0100 Subject: [PATCH] UI: Use invokeMethod to refresh LoadAudioSources Sources may be removed or destroyed by other threads which resulted in GUI calls outside of the main Qt thread. --- UI/window-basic-settings.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/UI/window-basic-settings.cpp b/UI/window-basic-settings.cpp index 75bf5e082..be0197f7c 100644 --- a/UI/window-basic-settings.cpp +++ b/UI/window-basic-settings.cpp @@ -2247,10 +2247,12 @@ void OBSBasicSettings::LoadAudioSources() label->setMinimumSize(QSize(170, 0)); label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); - connect(label, &OBSSourceLabel::Removed, - [=]() { LoadAudioSources(); }); - connect(label, &OBSSourceLabel::Destroyed, - [=]() { LoadAudioSources(); }); + connect(label, &OBSSourceLabel::Removed, [=]() { + QMetaObject::invokeMethod(this, "ReloadAudioSources"); + }); + connect(label, &OBSSourceLabel::Destroyed, [=]() { + QMetaObject::invokeMethod(this, "ReloadAudioSources"); + }); layout->addRow(label, form); return true;