UI: Fix bug when canceling first source properties

When you launch the source properties for the first time, the settings
for the source are empty and default values are used.  With the new
OK/Cancel buttons that were recently merged, it first saves the old
settings, then if the user cancels applies those old settings.

However, because the first settings are always empty, obs_source_update
will try to apply the old settings (which are empty) to the modified
settings, but it can't reset to those settings because it's technically
not applying any settings at all.

In other words, when you create the source and modified the properties
for your first time, pressing cancel would not reset anything at all.

This fixes that issue by clearing the current settings with
obs_data_clear before updating the source with the old settings, which
ensures that any settings that were empty are reset to an empty status.
master
jp9000 2015-01-24 22:10:37 -08:00
parent af8d5db4ad
commit 4093ce4d84
1 changed files with 5 additions and 0 deletions

View File

@ -112,7 +112,12 @@ void OBSBasicProperties::on_buttonBox_clicked(QAbstractButton *button)
}
if (val == QDialogButtonBox::RejectRole) {
obs_data_t *settings = obs_source_get_settings(source);
obs_data_clear(settings);
obs_data_release(settings);
obs_source_update(source, oldSettings);
close();
}
}