[gtk+/gtk-3-22] flowbox: don’t try to focus or draw NULL widgets



commit 02d537834ae7138302861f04df6c86759fd55b27
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Apr 5 20:10:09 2017 -0400

    flowbox: don’t try to focus or draw NULL widgets
    
    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 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 24af737..e9e2504 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]