Browse Source

UI: Fix activation order of profile and scene collections after delete

After a profile or scene collection is deleted, the last item in each
list would have been automatically activated as the new current profile
or scene collection.

This is opposite to prior behavior, which would always select the first
item in the list.

This code restores the prior behavior.
PatTheMav 1 year ago
parent
commit
a05f5f5009
2 changed files with 2 additions and 2 deletions
  1. 1 1
      UI/window-basic-main-profiles.cpp
  2. 1 1
      UI/window-basic-main-scene-collections.cpp

+ 1 - 1
UI/window-basic-main-profiles.cpp

@@ -498,7 +498,7 @@ void OBSBasic::on_actionRemoveProfile_triggered(bool skipConfirmation)
 		blog(LOG_ERROR, "%s", error.what());
 	}
 
-	const OBSProfile &newProfile = profiles.rbegin()->second;
+	const OBSProfile &newProfile = profiles.begin()->second;
 
 	ActivateProfile(newProfile, true);
 	RemoveProfile(currentProfile);

+ 1 - 1
UI/window-basic-main-scene-collections.cpp

@@ -507,7 +507,7 @@ void OBSBasic::on_actionRemoveSceneCollection_triggered(bool skipConfirmation)
 		blog(LOG_ERROR, "%s", error.what());
 	}
 
-	const OBSSceneCollection &newCollection = collections.rbegin()->second;
+	const OBSSceneCollection &newCollection = collections.begin()->second;
 
 	ActivateSceneCollection(newCollection);
 	RemoveSceneCollection(currentCollection);