Просмотр исходного кода

UI: Don't std::move main in SetUndoProperties

main is used later in the function, making this undefined behavior.
Though we can move the scene_name string.

Detected by PVS Studio.
Richard Stanway 2 лет назад
Родитель
Сommit
a781f4a887
1 измененных файлов с 2 добавлено и 2 удалено
  1. 2 2
      UI/context-bar-controls.cpp

+ 2 - 2
UI/context-bar-controls.cpp

@@ -56,8 +56,8 @@ void SourceToolbar::SetUndoProperties(obs_source_t *source, bool repeatable)
 	if (!currentSceneSource)
 		return;
 	std::string scene_name = obs_source_get_name(currentSceneSource);
-	auto undo_redo = [scene_name,
-			  main = std::move(main)](const std::string &data) {
+	auto undo_redo = [scene_name = std::move(scene_name),
+			  main](const std::string &data) {
 		OBSDataAutoRelease settings =
 			obs_data_create_from_json(data.c_str());
 		OBSSourceAutoRelease source = obs_get_source_by_name(