Browse Source

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.
Richard Stanway 6 years ago
parent
commit
2a4a46deed
1 changed files with 6 additions and 4 deletions
  1. 6 4
      UI/window-basic-settings.cpp

+ 6 - 4
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;