[gtk/gtk-4-6: 10/15] paned: Warn if child is not actually a child




commit 89fc4efe6fa286cda32cddc5768099278b514898
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Aug 9 14:20:25 2022 -0300

    paned: Warn if child is not actually a child
    
    This will at least allow us to debug this in the future.

 gtk/gtkpaned.c | 9 +++++++++
 1 file changed, 9 insertions(+)
---
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index b0397f500c..9d9de9fbf9 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -1999,6 +1999,15 @@ gtk_paned_set_focus_child (GtkWidget *widget,
             if (GTK_IS_PANED (w))
               last_focus = w;
 
+          if (w == NULL)
+            {
+              g_warning ("Error finding last focus widget of GtkPaned %p, "
+                         "gtk_paned_set_focus_child was called on widget %p "
+                         "which is not child of %p.",
+                         widget, child, widget);
+              return;
+            }
+
           focus_child = gtk_widget_get_focus_child (widget);
           if (focus_child == paned->start_child)
             gtk_paned_set_last_start_child_focus (paned, last_focus);


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