Skip to content

Issue #10371: Prevent FileChooser widget from crashing when committed

Alx Sa requested to merge alxsa-gegl-file-crash into master

This patch attempts to resolve issue #10371 (closed).

GEGL filters can have a file property - the widget for which is created by gimp_prop_file_chooser_button_new (). The "file-set" signal is connected to gimp_prop_file_chooser_button_callback (). This function dereferences the GFile object twice accidentally - once under the if (GIMP_IS_PARAM_SPEC_CONFIG_PATH (param_spec)) condition and then again at the end of the function. As a result, GIMP crashes once the filter GUI is closed and cleaned up (if you set a file for that property).

This is likely due to how it's set up in 2.10, where there's not a second condition so it's okay to free the GFile after the first use.

Removing the first g_object_unref (file); and only dereferencing GFile at the end of the function seems to fix the problem. I tested with the third-party plug-in SSG, but it should work for any filter that has a file property.

Merge request reports