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 755352 - Crash on widget destruction during event handling
Crash on widget destruction during event handling
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkGesture
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-09-21 13:52 UTC by Carlos Garnacho
Modified: 2015-09-21 14:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gesture: strengthen against destroyed windows (1.27 KB, patch)
2015-09-21 13:53 UTC, Carlos Garnacho
committed Details | Review
widget: Make sure we only run controllers on realized widgets (927 bytes, patch)
2015-09-21 13:53 UTC, Carlos Garnacho
none Details | Review
widget: Make sure we only run controllers on realized widgets (933 bytes, patch)
2015-09-21 13:56 UTC, Carlos Garnacho
committed Details | Review

Description Carlos Garnacho 2015-09-21 13:52:19 UTC
From #gtk+ yesterday:

baedert	garnacho_: Remember when we had this bug about a widget destroying itself triggered by a gesture (in a listbox if that helps)?
        garnacho_: http://paste.fedoraproject.org/269480/44276664/ :(
        Also seems to happen with 3.16.7

(The bt for bz reference):

  • #0 _g_log_abort
    at gmessages.c line 324
  • #1 g_logv
    at gmessages.c line 1081
  • #2 g_log
    at gmessages.c line 1119
  • #3 g_return_if_fail_warning
  • #4 gtk_widget_get_window
    at gtkwidget.c line 15855
  • #5 _update_widget_coordinates
    at gtkgesture.c line 478
  • #6 _gtk_gesture_update_point
    at gtkgesture.c line 607
  • #7 gtk_gesture_handle_event
    at gtkgesture.c line 770
  • #8 gtk_gesture_single_handle_event
    at gtkgesturesingle.c line 221
  • #9 gtk_event_controller_handle_event
    at gtkeventcontroller.c line 230
  • #10 _gtk_widget_run_controllers
    at gtkwidget.c line 7326
  • #11 gtk_widget_real_button_event
    at gtkwidget.c line 7104
  • #12 _gtk_marshal_BOOLEAN__BOXEDv
    at gtkmarshalers.c line 130
  • #13 g_type_class_meta_marshalv
    at gclosure.c line 1021
  • #14 _g_closure_invoke_va
    at gclosure.c line 864
  • #15 g_signal_emit_valist
    at gsignal.c line 3292
  • #16 g_signal_emit
    at gsignal.c line 3439
  • #17 gtk_widget_event_internal
    at gtkwidget.c line 7697
  • #18 gtk_widget_event
    at gtkwidget.c line 7264
  • #19 propagate_event_up
    at gtkmain.c line 2511
  • #20 propagate_event
    at gtkmain.c line 2613
  • #21 gtk_propagate_event
    at gtkmain.c line 2648
  • #22 gtk_main_do_event
    at gtkmain.c line 1844
  • #23 _gdk_event_emit
    at gdkevents.c line 69
  • #24 gdk_event_source_dispatch.lto_priv.1294
    at gdkeventsource.c line 364
  • #25 g_main_dispatch
    at gmain.c line 3154
  • #26 g_main_context_dispatch
    at gmain.c line 3769
  • #27 g_main_context_iterate
    at gmain.c line 3840
  • #28 g_main_context_iteration
    at gmain.c line 3901
  • #29 g_application_run
    at gapplication.c line 2311
  • #30 _vala_main
    at /home/baedert/Code/Vala/Corebird/src/main.vala line 27
  • #31 __libc_start_main
    from /usr/lib/libc.so.6
  • #32 _start

I haven't seen the crash myself, but it looks like there's places where we could be more resilient against destroyed/unrealized widgets along event processing, I'm attaching a couple of patches that'll improve the situation.
Comment 1 Carlos Garnacho 2015-09-21 13:53:36 UTC
Created attachment 311753 [details] [review]
gesture: strengthen against destroyed windows

Bail out when we receive an event with an already destroyed window,
we'll hopefully get reset/cancelled afterwards on grab broken events.
Comment 2 Carlos Garnacho 2015-09-21 13:53:42 UTC
Created attachment 311754 [details] [review]
widget: Make sure we only run controllers on realized widgets

The default event bubbling paths are prone to just running event controllers
even after the widget was potentially unrealized/destroyed in an event
handler callback, so bail out early if that's the case.
Comment 3 Carlos Garnacho 2015-09-21 13:56:07 UTC
Created attachment 311756 [details] [review]
widget: Make sure we only run controllers on realized widgets

The default event bubbling paths are prone to just running event controllers
even after the widget was potentially unrealized/destroyed in an event
handler callback, so bail out early if that's the case.
Comment 4 Timm Bäder 2015-09-21 14:21:03 UTC
This fixes the problem for me, thanks!
Comment 5 Carlos Garnacho 2015-09-21 14:34:48 UTC
Attachment 311753 [details] pushed as defa1e9 - gesture: strengthen against destroyed windows
Attachment 311756 [details] pushed as b323252 - widget: Make sure we only run controllers on realized widgets