[gtk+] window: Some protection against nested set_focus() calls



commit 6a837c668a6dbb65daf7420ab30ce240b104771d
Author: Stef Walter <stefw redhat com>
Date:   Fri Aug 16 21:19:15 2013 +0200

    window: Some protection against nested set_focus() calls
    
    Since set_focus() can triger events, have a check to make
    sure state is still valid before firing is-focus signal.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706152

 gtk/gtkwindow.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index df0ec26..e611a70 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7514,7 +7514,11 @@ gtk_window_real_set_focus (GtkWindow *window,
       if (priv->has_focus)
        do_focus_change (priv->focus_widget, TRUE);
 
-      g_object_notify (G_OBJECT (priv->focus_widget), "is-focus");
+      /* It's possible for do_focus_change() above to have callbacks
+       * that clear priv->focus_widget here.
+       */
+      if (priv->focus_widget)
+        g_object_notify (G_OBJECT (priv->focus_widget), "is-focus");
     }
 
   /* If the default widget changed, a redraw will have been queued


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