[gedit] FileChooser: keep a ref to the GtkFileFilter for setting it as default
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit] FileChooser: keep a ref to the GtkFileFilter for setting it as default
- Date: Mon, 8 Jun 2020 18:41:35 +0000 (UTC)
commit 397f3a0b827c877bdc418fa8c966c5f548220bdc
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jun 8 20:24:16 2020 +0200
FileChooser: keep a ref to the GtkFileFilter for setting it as default
See the docs of gtk_file_chooser_add_filter().
gedit/gedit-file-chooser.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gedit/gedit-file-chooser.c b/gedit/gedit-file-chooser.c
index 342f8d901..eea6719bb 100644
--- a/gedit/gedit-file-chooser.c
+++ b/gedit/gedit-file-chooser.c
@@ -153,25 +153,29 @@ _gedit_file_chooser_setup_filters (GtkFileChooser *chooser)
all_text_files_filter,
NULL,
NULL);
- gtk_file_chooser_add_filter (chooser, filter);
+ g_object_ref_sink (filter);
+ gtk_file_chooser_add_filter (chooser, filter);
if (active_filter != 1)
{
/* Use this filter if set by user and as default. */
gtk_file_chooser_set_filter (chooser, filter);
}
+ g_object_unref (filter);
/* "All Files" filter */
filter = gtk_file_filter_new ();
gtk_file_filter_set_name (filter, ALL_FILES);
gtk_file_filter_add_pattern (filter, "*");
- gtk_file_chooser_add_filter (chooser, filter);
+ g_object_ref_sink (filter);
+ gtk_file_chooser_add_filter (chooser, filter);
if (active_filter == 1)
{
/* Use this filter if set by user. */
gtk_file_chooser_set_filter (chooser, filter);
}
+ g_object_unref (filter);
g_signal_connect (chooser,
"notify::filter",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]