From 9ca7e1cb0f1a8c16eb7e565da763ea2591169991 Mon Sep 17 00:00:00 2001 From: Clayton Groeneveld Date: Sat, 3 Apr 2021 23:35:57 -0500 Subject: [PATCH] UI: Fix spamming of log when setting current scene When setting the current scene and if it was the same as the previous, the log would be spammed with switching scene messages. This issue particularly happened when using undo/redo, as their functions were setting the current scene. --- UI/window-basic-main-transitions.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/UI/window-basic-main-transitions.cpp b/UI/window-basic-main-transitions.cpp index b68e359fe..64eae7e10 100644 --- a/UI/window-basic-main-transitions.cpp +++ b/UI/window-basic-main-transitions.cpp @@ -731,11 +731,10 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force) obs_source_inc_showing(scene); if (actualLastScene) obs_source_dec_showing(actualLastScene); - lastScene = OBSGetWeakRef(scene); } } - if (obs_scene_get_source(GetCurrentScene()) != scene) { + if (OBSGetStrongRef(lastScene) != scene) { for (int i = 0; i < ui->scenes->count(); i++) { QListWidgetItem *item = ui->scenes->item(i); OBSScene itemScene = GetOBSRef(item); @@ -751,16 +750,16 @@ void OBSBasic::SetCurrentScene(OBSSource scene, bool force) break; } } - } - UpdateContextBar(true); + lastScene = OBSGetWeakRef(scene); - if (scene) { bool userSwitched = (!force && !disableSaving); blog(LOG_INFO, "%s to scene '%s'", userSwitched ? "User switched" : "Switched", obs_source_get_name(scene)); } + + UpdateContextBar(true); } void OBSBasic::CreateProgramDisplay() @@ -1645,7 +1644,6 @@ void OBSBasic::SetPreviewProgramMode(bool enabled) OBSSource actualLastScene = OBSGetStrongRef(lastScene); if (actualLastScene) obs_source_dec_showing(actualLastScene); - lastScene = nullptr; } programScene = nullptr;