[glib] gsignal: Properly handle NULL nodes



commit 56411bb67807cb5306f495d41276fe6855cdcee7
Author: Colin Walters <walters verbum org>
Date:   Thu Jun 21 12:12:53 2012 -0400

    gsignal: Properly handle NULL nodes

 gobject/gsignal.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/gobject/gsignal.c b/gobject/gsignal.c
index 7c90a7a..6913979 100644
--- a/gobject/gsignal.c
+++ b/gobject/gsignal.c
@@ -1017,12 +1017,16 @@ g_signal_remove_emission_hook (guint  signal_id,
   SIGNAL_LOCK ();
   node = LOOKUP_SIGNAL_NODE (signal_id);
   if (!node || node->destroyed)
-    g_warning ("%s: invalid signal id `%u'", G_STRLOC, signal_id);
+    {
+      g_warning ("%s: invalid signal id `%u'", G_STRLOC, signal_id);
+      goto out;
+    }
   else if (!node->emission_hooks || !g_hook_destroy (node->emission_hooks, hook_id))
     g_warning ("%s: signal \"%s\" had no hook (%lu) to remove", G_STRLOC, node->name, hook_id);
 
   node->single_va_closure_is_valid = FALSE;
 
+ out:
   SIGNAL_UNLOCK ();
 }
 
@@ -1775,9 +1779,9 @@ g_signal_set_va_marshaller (guint              signal_id,
 	  if (cc->closure->marshal == node->c_marshaller)
 	    _g_closure_set_va_marshal (cc->closure, va_marshaller);
 	}
-    }
 
-  node->single_va_closure_is_valid = FALSE;
+      node->single_va_closure_is_valid = FALSE;
+    }
 
   SIGNAL_UNLOCK ();
 }



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