seed r600 - trunk/libseed



Author: racarr
Date: Wed Dec 31 05:23:21 2008
New Revision: 600
URL: http://svn.gnome.org/viewvc/seed?rev=600&view=rev

Log:
Consolidate some of the reference handling code.


Modified:
   trunk/libseed/seed-engine.c

Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c	(original)
+++ trunk/libseed/seed-engine.c	Wed Dec 31 05:23:21 2008
@@ -364,7 +364,7 @@
 		{
 			GIBaseInfo *interface;
 			GIInfoType type;
-			gboolean sunk = TRUE;
+			gboolean sunk = FALSE;
 
 			if (tag == GI_TYPE_TAG_INTERFACE)
 			{
@@ -383,8 +383,9 @@
 				{
 					if (G_IS_OBJECT(retval.v_pointer))
 					{
-						sunk = g_object_is_floating(G_OBJECT(retval.v_pointer));
-						g_object_ref_sink(G_OBJECT(retval.v_pointer));
+						sunk = G_IS_INITIALLY_UNOWNED(G_OBJECT(retval.v_pointer));
+						if (sunk)
+							g_object_ref_sink(G_OBJECT(retval.v_pointer));
 					}
 				}
 
@@ -392,11 +393,12 @@
 			retval_ref =
 				seed_gi_argument_make_js(ctx, &retval, type_info, exception);
 
-			if (!sunk)
+			if (sunk)
 				g_object_unref(G_OBJECT(retval.v_pointer));
-
-			seed_gi_release_arg(g_callable_info_get_caller_owns
-								((GICallableInfo *) info), type_info, &retval);
+			else
+				seed_gi_release_arg(g_callable_info_get_caller_owns
+									((GICallableInfo *) info),
+									type_info, &retval);
 		}
 		g_base_info_unref((GIBaseInfo *) type_info);
 	}



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