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.
This commit is contained in:
Clayton Groeneveld 2021-04-03 23:35:57 -05:00 • committed by Jim
commit 9ca7e1cb0f

View file

@ -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<OBSScene>(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;