GNOME Bugzilla – Bug 726857
GtkFileChooser crashes app if not destroyed
Last modified: 2018-05-02 16:00:47 UTC
I was attempting to reuse a single GtkFileChooser in my app rather than repeatedly creating, running and destroying one every time I needed it, i.e., I would gtk_widget_hide() the chooser after running it rather than calling gtk_widget_destroy(). This design would ultimately trigger messages of the form (myapp:13754): Gtk-CRITICAL **: gtk_tree_model_filter_get_path: assertion 'GTK_TREE_MODEL_FILTER (model)->priv->stamp == iter->stamp' failed at random times after the dialog was hidden, which always resulted in a core dump. The stack backtraces included these calls:
+ Trace 233383
These appear to result from some kind of background file chooser model update activity. Although the gtk+3 documentation shows a call to gtk_widget_destroy() in the code example for the GtkFileChooser, this is not mentioned as a strict requirement. In my opinion, either (1) this should be clearly documented as a strict requirement, (2) the file chooser code should be modified to disable this model update activity when the chooser is not active, or (3) there should be an API mechanism to disable this model update activity while the chooser is hidden from view. Thanks! Roger Davis Univ. of Hawaii
fwiw, see Bug 702853 for (probably not even all) of the problems that occur when reusing FileChooser widgets. They really don't seem prepared for it. :( Bug 475628 may be ultimately the same, if the problem is undefined behaviour causing unpredictable errors. I had to give up and just destroy/rebuild mine, which feels like a waste, but until some brave person figures out what's going on, it seems to be the only way. Maybe one day...
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/477.