[PATCH] Added a function in gtk-gui.c for setting default file filters to a widget

Lubomir I. Ivanov neolit123 at gmail.com
Tue Jul 31 17:23:40 PDT 2012


^

i was a bit skeptical that the filters leak memory.
the GTK API seems a bit odd here, but i might be missing something.

there is allocation of a GtkFileFilter object (or at least the naming
suggest so - gtk_file_filter_new) + the addition of patters (which are
more bytes), but then what handles the deallocation ?
apparently once a file filter is created and added to a
GtkFileChooser, it exist until the widget is destroyed.

then trying to reuse the same pointer results in access violation,
therefore the entire procedure of creating a filter has to be repeated
each time a widget is created.
also there isn't an obvious method to deallocate a filter, so what if
a filter was never added to a widget ?

perhaps a much more intuitive and faster alternative would have been
to allocate filters only once, make them reusable, then clean them
manually when needed or pass arguments to widget "destroyers" to do
that explicitly.

/mini-api-design-rant

lubomir
--


More information about the subsurface mailing list