Ver código fonte

UI: Don't update text source when nothing changed

(cherry picked from commit e830043851a4dc39cd67f81bc9b25cf8666ef613)
Exeldro 2 anos atrás
pai
commit
0be3b3b845
1 arquivos alterados com 7 adições e 4 exclusões
  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) {
 		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);
 
-	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);
 }