GNOME Bugzilla – Bug 780734
flowbox: don’t try to focus or draw NULL widgets
Last modified: 2017-04-06 00:16:33 UTC
Rubberbanding over an empty area results in warnings, due to the code trying to focus and queue a null pointer for drawing.
Created attachment 349013 [details] [review] flowbox: don’t try to focus or draw NULL widgets
most callers seem to avoid calling gtk_flow_box_update_cursor (..., NULL) can you show a stacktrace from where that call originates ?
+ Trace 237303
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.
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;
(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.
Attachment 349013 [details] pushed as 7860e2d - flowbox: don’t try to focus or draw NULL widgets