flowbox: don’t try to focus or draw NULL widgets
authorMatthias Clasen <mclasen@redhat.com>
Thu, 6 Apr 2017 00:10:09 +0000 (20:10 -0400)
committerU-eagle\daniel.boles <daniel.boles@Eagle-LT09.eagle.local>
Thu, 6 Apr 2017 14:12:33 +0000 (15:12 +0100)
Rubberbanding over an empty area results in warnings, due to the code
trying to focus and queue a null pointer for drawing.

https://bugzilla.gnome.org/show_bug.cgi?id=780734

gtk/gtkflowbox.c

index 24af73788283e0f7c11228422cc4bdd7407060e9..e9e2504fd005dcaf94240eeeffc127e8b76f21c4 100644 (file)
@@ -2951,7 +2951,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);
     }
 
@@ -2961,7 +2962,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;