seed r526 - trunk/libseed



Author: racarr
Date: Sun Dec 21 01:46:48 2008
New Revision: 526
URL: http://svn.gnome.org/viewvc/seed?rev=526&view=rev

Log:
Fix some reference leaks for some weird objects.

Modified:
   trunk/libseed/seed-engine.c
   trunk/libseed/seed-signals.c

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Sun Dec 21 01:46:48 2008
@@ -100,7 +100,8 @@
 	JSPropertyNameArrayRef jsprops = 0;
 	JSStringRef jsprop_name;
 	JSValueRef jsprop_value;
-
+	gboolean sunk = TRUE;
+	
 	type = (GType) JSObjectGetPrivate(constructor);
 	if (!type)
 		return 0;
@@ -191,7 +192,9 @@
 
 	gobject = g_object_newv(type, nparams, params);
 
-	g_object_ref_sink(gobject);
+	sunk = g_object_is_floating(gobject);
+	if (sunk)
+		g_object_ref_sink(gobject);
 
 	if (!gobject)
 		ret = (JSObjectRef) JSValueMakeNull(ctx);
@@ -204,6 +207,7 @@
 		g_free((gchar *)params[i].name);
 	}
 
+	// Give up ref
 	g_object_unref(gobject);
 
 	g_type_class_unref(oclass);

Modified: trunk/libseed/seed-signals.c
==============================================================================
--- trunk/libseed/seed-signals.c	(original)
+++ trunk/libseed/seed-signals.c	Sun Dec 21 01:46:48 2008
@@ -105,7 +105,7 @@
 	
 	if (this_obj && !JSValueIsNull(ctx, this_obj))
 	{
-		JSValueProtect(ctx, this_obj);
+//		JSValueProtect(ctx, this_obj);
 		((SeedClosure *) closure)->this = this_obj;
 	}
 	else
@@ -116,7 +116,7 @@
 	if (user_data && !JSValueIsNull(ctx, user_data))
 	{
 		((SeedClosure *) closure)->user_data = user_data;
-		JSValueProtect(ctx, user_data);
+//		JSValueProtect(ctx, user_data);
 	}
 
 	JSValueProtect(ctx, (JSObjectRef) func);



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