Skip to content

Commit

Permalink
filechooser: Fix crash when opening a file chooser with single filter…
Browse files Browse the repository at this point in the history
… set

'gtk_file_filter_new_from_gvariant()' returns a 'GtkFileFilter' which
is a floating reference in GTK3.

Since the portal is taking ownership of the file filter through
'g_autoptr', we call 'g_object_ref_sink()' unconditionally when
creating the filter instance.
  • Loading branch information
sidt4 authored and GeorgesStavracas committed Oct 18, 2023
1 parent a1fff44 commit 1c09aaf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/filechooser.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ handle_open (XdpImplFileChooser *object,
g_autoptr (GtkFileFilter) filter = NULL;
const char *current_filter_name;

filter = gtk_file_filter_new_from_gvariant (current_filter);
filter = g_object_ref_sink (gtk_file_filter_new_from_gvariant (current_filter));
current_filter_name = gtk_file_filter_get_name (filter);

if (!filters)
Expand Down

0 comments on commit 1c09aaf

Please sign in to comment.