After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719936 - GtkFontButton: Make sure the dialog isn't destroyed on delete-event
GtkFontButton: Make sure the dialog isn't destroyed on delete-event
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-12-05 22:00 UTC by Rui Matos
Modified: 2014-09-29 02:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkFontButton: Make sure the dialog isn't destroyed on delete-event (1.15 KB, patch)
2013-12-05 22:00 UTC, Rui Matos
committed Details | Review

Description Rui Matos 2013-12-05 22:00:00 UTC
I initially thought to fix this by always keeping font_filter and
friends around after building the dialog and resetting them on the
dialog once it gets rebuilt (on button clicked). But then I realized
that font_filter_data gets freed by the destroy notify when the dialog
is destroyed so I think this solution of trying to keep the dialog
alive will have to do.

I can't think of any other way for the dialog to be destroyed except
getting a pointer to the dialog (using gtk_window_list_toplevels() or
similar) and calling gtk_widget_destroy() on it. But in this case I
think you get what you deserve.
Comment 1 Rui Matos 2013-12-05 22:00:02 UTC
Created attachment 263626 [details] [review]
GtkFontButton: Make sure the dialog isn't destroyed on delete-event

The remaining code assumes that the dialog doesn't get destroyed, but
it actually does on delete-event.

In particular, the filter function and the preview text are lost as
soon as the dialog is created and thus when we create a new dialog we
don't have those properties to set on it anymore.
Comment 2 Matthias Clasen 2014-05-22 01:04:45 UTC
is this really a big concern though ?
with csd decorations, the font chooser dialog doesn't have a close button, just cancel+select, so the user already has to be quite determined to really delete the window.
Comment 3 Rui Matos 2014-05-22 09:03:13 UTC
Both Escape and Alt+F4 still result in a delete-event though.

Note that the issue that made me look into this was that the gtk_font_chooser_set_filter_func() API was only working for the first time that button was clicked.
Comment 4 Matthias Clasen 2014-09-28 00:17:15 UTC
Review of attachment 263626 [details] [review]:

Sure
Comment 5 Matthias Clasen 2014-09-29 02:09:54 UTC
Attachment 263626 [details] pushed as d05730d - GtkFontButton: Make sure the dialog isn't destroyed on delete-event