[seed] Fix possible leak of signal user data



commit 3d696e4cc8824640cd1f9fa7b051d03036db1da2
Author: Robert Carr <racarr svn gnome org>
Date:   Tue Apr 21 18:34:44 2009 -0400

    Fix possible leak of signal user data
---
 libseed/seed-signals.c |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/libseed/seed-signals.c b/libseed/seed-signals.c
index c2e199e..8ab346e 100644
--- a/libseed/seed-signals.c
+++ b/libseed/seed-signals.c
@@ -45,12 +45,8 @@ closure_invalidated (gpointer data, GClosure * c)
   SeedClosure *closure = (SeedClosure *) c;
   
   SEED_NOTE (FINALIZATION, "Finalizing closure.");
-/*
-  WebKit bug?
-	if (!JSValueIsUndefined(ctx, closure->user_data))
-		JSValueUnprotect(ctx, closure->user_data);
-	if (!JSValueIsUndefined(ctx, closure->this))
-	JSValueUnprotect(ctx, closure->this);*/
+  if (closure->user_data && !JSValueIsUndefined(ctx, closure->user_data))
+    JSValueUnprotect(ctx, closure->user_data);
   if (!JSValueIsUndefined (ctx, closure->function))
     JSValueUnprotect (ctx, closure->function);
 
@@ -108,7 +104,7 @@ seed_gobject_signal_connect (JSContextRef ctx,
   if (user_data && !JSValueIsNull (ctx, user_data))
     {
       ((SeedClosure *) closure)->user_data = user_data;
-      //  JSValueProtect(ctx, user_data);
+      JSValueProtect(ctx, user_data);
     }
 
   g_signal_connect_closure (on_obj, signal_name, closure, FALSE);



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