Преглед на файлове

win-capture: Return early in property callbacks if param is null

When obs_get_source_properties is called, it calls the property modified
callbacks without a source instantiation. The callbacks set in
.get_properties for display capture and window capture would then result
in exceptions when anything is dereferenced on the source, such as
wgc_supported or update_mutex, because the source itself is null. Let's
make the callbacks return early if the property param is null.
Ryan Foster преди 4 години
родител
ревизия
85ffdd57f4
променени са 2 файла, в които са добавени 9 реда и са изтрити 0 реда
  1. 3 0
      plugins/win-capture/duplicator-monitor-capture.c
  2. 6 0
      plugins/win-capture/window-capture.c

+ 3 - 0
plugins/win-capture/duplicator-monitor-capture.c

@@ -628,6 +628,9 @@ static bool display_capture_method_changed(obs_properties_t *props,
 	UNUSED_PARAMETER(p);
 
 	struct duplicator_capture *capture = obs_properties_get_param(props);
+	if (!capture)
+		return false;
+
 	update_settings(capture, settings);
 
 	update_settings_visibility(props, capture);

+ 6 - 0
plugins/win-capture/window-capture.c

@@ -363,6 +363,9 @@ static bool wc_capture_method_changed(obs_properties_t *props,
 	UNUSED_PARAMETER(p);
 
 	struct window_capture *wc = obs_properties_get_param(props);
+	if (!wc)
+		return false;
+
 	update_settings(wc, settings);
 
 	update_settings_visibility(props, wc);
@@ -379,6 +382,9 @@ static bool wc_window_changed(obs_properties_t *props, obs_property_t *p,
 			      obs_data_t *settings)
 {
 	struct window_capture *wc = obs_properties_get_param(props);
+	if (!wc)
+		return false;
+
 	update_settings(wc, settings);
 
 	update_settings_visibility(props, wc);