[gtk+/composite-templates] GtkActionHelper: two small fixups in _set_target_value()



commit ae30cfc5b22a6b21d4970ffa84e3301d1a9adefb
Author: Ryan Lortie <desrt desrt ca>
Date:   Wed Aug 22 00:54:57 2012 -0400

    GtkActionHelper: two small fixups in _set_target_value()
    
    First, ensure we always consume floating values, as documented.
    
    Second (and more serious), don't try to query the action if the
    action name is not set yet.  This will cause crashes...

 gtk/gtkactionhelper.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkactionhelper.c b/gtk/gtkactionhelper.c
index 6047a43..a3a0c46 100644
--- a/gtk/gtkactionhelper.c
+++ b/gtk/gtkactionhelper.c
@@ -523,7 +523,10 @@ gtk_action_helper_set_action_target_value (GtkActionHelper *helper,
     return;
 
   if (target_value && helper->target && g_variant_equal (target_value, helper->target))
-    return;
+    {
+      g_variant_unref (g_variant_ref_sink (target_value));
+      return;
+    }
 
   if (helper->target)
     {
@@ -534,6 +537,10 @@ gtk_action_helper_set_action_target_value (GtkActionHelper *helper,
   if (target_value)
     helper->target = g_variant_ref_sink (target_value);
 
+  /* The action_name has not yet been set.  Don't do anything yet. */
+  if (helper->action_name == NULL)
+    return;
+
   was_enabled = helper->enabled;
   was_active = helper->active;
 



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