瀏覽代碼

UI: Don't update text source when nothing changed

(cherry picked from commit e830043851a4dc39cd67f81bc9b25cf8666ef613)
Exeldro 2 年之前
父節點
當前提交
0be3b3b845
共有 1 個文件被更改,包括 7 次插入4 次删除
  1. 7 4
      UI/context-bar-controls.cpp

+ 7 - 4
UI/context-bar-controls.cpp

@@ -728,12 +728,15 @@ void TextSourceToolbar::on_text_textChanged()
 	if (!source) {
 	if (!source) {
 		return;
 		return;
 	}
 	}
-
+	std::string newText = QT_TO_UTF8(ui->text->text());
+	OBSDataAutoRelease settings = obs_source_get_settings(source);
+	if (newText == obs_data_get_string(settings, "text")) {
+		return;
+	}
 	SaveOldProperties(source);
 	SaveOldProperties(source);
 
 
-	OBSDataAutoRelease settings = obs_data_create();
-	obs_data_set_string(settings, "text", QT_TO_UTF8(ui->text->text()));
-	obs_source_update(source, settings);
+	obs_data_set_string(settings, "text", newText.c_str());
+	obs_source_update(source, nullptr);
 
 
 	SetUndoProperties(source, true);
 	SetUndoProperties(source, true);
 }
 }