Browse Source

UI: Fix changed state of audio settings

When changing audio channels, sample rate, or audio buffering settings
multiple times by hitting `Apply` button, the internal `changed` state
got corrupted. To avoid this, set the changed state when changed
something, but do not clear the changed state.

(cherry picked from commit 846cdafbed4a3e84f42a35cd0bfd38a2bf5e205d)
Norihiro Kamae 2 years ago
parent
commit
0b7ac96157
1 changed files with 4 additions and 6 deletions
  1. 4 6
      UI/window-basic-settings.cpp

+ 4 - 6
UI/window-basic-settings.cpp

@@ -4643,17 +4643,15 @@ void OBSBasicSettings::AudioChangedRestart()
 		if (currentChannelIndex != channelIndex ||
 		if (currentChannelIndex != channelIndex ||
 		    currentSampleRateIndex != sampleRateIndex ||
 		    currentSampleRateIndex != sampleRateIndex ||
 		    currentLLAudioBufVal != llBufferingEnabled) {
 		    currentLLAudioBufVal != llBufferingEnabled) {
-			audioChanged = true;
 			ui->audioMsg->setText(
 			ui->audioMsg->setText(
 				QTStr("Basic.Settings.ProgramRestart"));
 				QTStr("Basic.Settings.ProgramRestart"));
-			sender()->setProperty("changed", QVariant(true));
-			EnableApplyButton(true);
 		} else {
 		} else {
-			audioChanged = false;
 			ui->audioMsg->setText("");
 			ui->audioMsg->setText("");
-			sender()->setProperty("changed", QVariant(false));
-			EnableApplyButton(false);
 		}
 		}
+
+		audioChanged = true;
+		sender()->setProperty("changed", QVariant(true));
+		EnableApplyButton(true);
 	}
 	}
 }
 }