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 780734 - flowbox: don’t try to focus or draw NULL widgets
flowbox: don’t try to focus or draw NULL widgets
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-03-30 19:35 UTC by Ernestas Kulik
Modified: 2017-04-06 00:16 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flowbox: don’t try to focus or draw NULL widgets (1.21 KB, patch)
2017-03-30 19:35 UTC, Ernestas Kulik
committed Details | Review

Description Ernestas Kulik 2017-03-30 19:35:36 UTC
Rubberbanding over an empty area results in warnings, due to the code
trying to focus and queue a null pointer for drawing.
Comment 1 Ernestas Kulik 2017-03-30 19:35:41 UTC
Created attachment 349013 [details] [review]
flowbox: don’t try to focus or draw NULL widgets
Comment 2 Matthias Clasen 2017-03-30 20:30:57 UTC
most callers seem to avoid calling gtk_flow_box_update_cursor (..., NULL)

can you show a stacktrace from where that call originates ?
Comment 3 Ernestas Kulik 2017-03-31 05:27:44 UTC


  • #0 _g_log_abort
    at /home/ernestas/jhbuild/checkout/glib/glib/gmessages.c line 546
  • #1 g_logv
    at /home/ernestas/jhbuild/checkout/glib/glib/gmessages.c line 1357
  • #2 g_log
    at /home/ernestas/jhbuild/checkout/glib/glib/gmessages.c line 1398
  • #3 g_return_if_fail_warning
  • #4 gtk_widget_grab_focus
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkwidget.c line 7140
  • #5 gtk_flow_box_update_cursor
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkflowbox.c line 938
  • #6 gtk_flow_box_drag_gesture_update
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkflowbox.c line 2811
  • #7 ffi_call_unix64
    from /usr/lib/libffi.so.6
  • #8 ffi_call
    from /usr/lib/libffi.so.6
  • #9 g_cclosure_marshal_generic_va
    at /home/ernestas/jhbuild/checkout/glib/gobject/gclosure.c line 1604
  • #10 _g_closure_invoke_va
    at /home/ernestas/jhbuild/checkout/glib/gobject/gclosure.c line 867
  • #11 g_signal_emit_valist
    at /home/ernestas/jhbuild/checkout/glib/gobject/gsignal.c line 3300
  • #12 g_signal_emit
    at /home/ernestas/jhbuild/checkout/glib/gobject/gsignal.c line 3447
  • #13 gtk_gesture_drag_update
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkgesturedrag.c line 109
  • #14 g_cclosure_marshal_VOID__BOXEDv
    at /home/ernestas/jhbuild/checkout/glib/gobject/gmarshal.c line 1950
  • #15 g_type_class_meta_marshalv
    at /home/ernestas/jhbuild/checkout/glib/gobject/gclosure.c line 1024
  • #16 _g_closure_invoke_va
    at /home/ernestas/jhbuild/checkout/glib/gobject/gclosure.c line 867
  • #17 g_signal_emit_valist
    at /home/ernestas/jhbuild/checkout/glib/gobject/gsignal.c line 3300
  • #18 g_signal_emit
    at /home/ernestas/jhbuild/checkout/glib/gobject/gsignal.c line 3447
  • #19 gtk_gesture_handle_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkgesture.c line 801
  • #20 gtk_gesture_single_handle_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkgesturesingle.c line 222
  • #21 gtk_event_controller_handle_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkeventcontroller.c line 230
  • #22 _gtk_widget_run_controllers
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkwidget.c line 6698
  • #23 _gtk_widget_captured_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkwidget.c line 6752
  • #24 propagate_event_down
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkmain.c line 2214
  • #25 propagate_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkmain.c line 2262
  • #26 _gtk_propagate_captured_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkmain.c line 2305
  • #27 gtk_main_do_event
    at /home/ernestas/jhbuild/checkout/gtk+/gtk/gtkmain.c line 1569
  • #28 _gdk_event_emit
    at /home/ernestas/jhbuild/checkout/gtk+/gdk/gdkevents.c line 73
  • #29 gdk_event_source_dispatch
    at /home/ernestas/jhbuild/checkout/gtk+/gdk/x11/gdkeventsource.c line 367
  • #30 g_main_dispatch
    at /home/ernestas/jhbuild/checkout/glib/glib/gmain.c line 3212
  • #31 g_main_context_dispatch
    at /home/ernestas/jhbuild/checkout/glib/glib/gmain.c line 3865
  • #32 g_main_context_iterate
    at /home/ernestas/jhbuild/checkout/glib/glib/gmain.c line 3938
  • #33 g_main_context_iteration
    at /home/ernestas/jhbuild/checkout/glib/glib/gmain.c line 3999
  • #34 g_application_run
    at /home/ernestas/jhbuild/checkout/glib/gio/gapplication.c line 2381
  • #35 main
    at /home/ernestas/jhbuild/checkout/gtk+/demos/widget-factory/widget-factory.c line 1956

Comment 4 Ernestas Kulik 2017-03-31 05:30:29 UTC
I’m reproducing by changing the selection mode to multiple in the selection dialog in the widget factory demo, but it’s more a problem in Nautilus with the new flow view.
Comment 5 Matthias Clasen 2017-04-03 20:08:23 UTC
Here is an alternative patch, which should be slightly more correct.
Does this work for you ?


diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index d443047c96..2ad1d487ff 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2808,7 +2808,8 @@ gtk_flow_box_drag_gesture_update (GtkGestureDrag *gesture,
       g_object_unref (priv->rubberband_node);
 
       /* Grab focus here, so Escape-to-stop-rubberband  works */
-      gtk_flow_box_update_cursor (box, priv->rubberband_first);
+      if (priv->rubberband_first)
+        gtk_flow_box_update_cursor (box, priv->rubberband_first);
       gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
     }
 
@@ -2818,7 +2819,11 @@ gtk_flow_box_drag_gesture_update (GtkGestureDrag *gesture,
                                               start_y + offset_y);
 
       if (priv->rubberband_first == NULL)
-        priv->rubberband_first = child;
+        {
+          priv->rubberband_first = child;
+          if (priv->rubberband_first)
+            gtk_flow_box_update_cursor (box, priv->rubberband_first);
+        }
       if (child != NULL)
         priv->rubberband_last = child;
Comment 6 Ernestas Kulik 2017-04-04 10:27:48 UTC
(In reply to Matthias Clasen from comment #5)
> Here is an alternative patch, which should be slightly more correct.
> Does this work for you ?

Yup, does the trick.
Comment 7 Matthias Clasen 2017-04-06 00:16:27 UTC
Attachment 349013 [details] pushed as 7860e2d - flowbox: don’t try to focus or draw NULL widgets