GtkFileChooser crashes app if not destroyed
Submitted by Roger Davis
Link to original bug (#726857)
Description
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:
#9 0x00007f0755fe3df5 in remove_file (monitor=<value optimized out>,
file=<value optimized out>, other_file=<value optimized out>, type=<value
optimized out>, model=0x22b4d80) at gtkfilesystemmodel.c:1912
#10 gtk_file_system_model_monitor_change (monitor=<value optimized out>,
file=<value optimized out>, other_file=<value optimized out>, type=<value
optimized out>, model=0x22b4d80) at gtkfilesystemmodel.c:1257
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
Version: 3.10.x