admin管理员组

文章数量:1345476

(Using GTK 4.8 on Debian)

I created a file filter for specific image suffixes:

GtkFileFilter *file_filter = gtk_file_filter_new ();
gtk_file_filter_add_suffix (file_filter, "png");
gtk_file_filter_add_suffix (file_filter, "jpg");
gtk_file_filter_add_suffix (file_filter, "gif");

I then associated the file filter with a file chooser.

gtk_file_chooser_set_filter (GTK_FILE_CHOOSER(file_chooser), file_filter );

How do I properly finalize the file filter?

  • Does it have a reference count incremented by the file chooser, so destroying the file chooser also destroys the file filter?
  • Do I need to explicitly decrement the reference count using g_object_unref(file_filter)?
  • Something else?

I ask because the second option, g_object_unref(file_filter), gives me a runtime error g_object_unref: assertion 'G_IS_OBJECT (object)' failed.

本文标签: cProperly finalizing a GTK4 file filterStack Overflow