seed r282 - trunk/libseed
- From: racarr svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r282 - trunk/libseed
- Date: Fri, 21 Nov 2008 19:07:25 +0000 (UTC)
Author: racarr
Date: Fri Nov 21 19:07:25 2008
New Revision: 282
URL: http://svn.gnome.org/viewvc/seed?rev=282&view=rev
Log:
Add SEED_DEBUG_INVOCATION. and SEED_NOTES for method_invocation and argument release. Unref transfer ownership return values.
Modified:
trunk/libseed/seed-debug.h
trunk/libseed/seed-engine.c
trunk/libseed/seed-types.c
Modified: trunk/libseed/seed-debug.h
==============================================================================
--- trunk/libseed/seed-debug.h (original)
+++ trunk/libseed/seed-debug.h Fri Nov 21 19:07:25 2008
@@ -11,7 +11,8 @@
SEED_DEBUG_MISC = 1 << 1,
SEED_DEBUG_FINALIZATION = 1 << 2,
SEED_DEBUG_INITIALIZATION = 1 << 3,
- SEED_DEBUG_SIGNAL = 1 << 4
+ SEED_DEBUG_INVOCATION = 1<< 4,
+ SEED_DEBUG_SIGNAL = 1 << 5
} SeedDebugFlag;
#ifdef SEED_ENABLE_DEBUG
Modified: trunk/libseed/seed-engine.c
==============================================================================
--- trunk/libseed/seed-engine.c (original)
+++ trunk/libseed/seed-engine.c Fri Nov 21 19:07:25 2008
@@ -39,7 +39,8 @@
{ "misc", SEED_DEBUG_MISC },
{ "finalization", SEED_DEBUG_FINALIZATION },
{ "initialization", SEED_DEBUG_INITIALIZATION },
- { "signal", SEED_DEBUG_SIGNAL }
+ { "signal", SEED_DEBUG_SIGNAL },
+ { "invocation", SEED_DEBUG_INVOCATION }
};
#endif /* SEED_ENABLE_DEBUG */
@@ -294,16 +295,52 @@
g_base_info_unref((GIBaseInfo *) type_info);
g_base_info_unref((GIBaseInfo *) arg_info);
}
+ SEED_NOTE(INVOCATION, "Invoking method: %s with %d in arguments"
+ " and %d out arguments",
+ g_base_info_get_name(info),
+ n_in_args,
+ n_out_args);
if (g_function_info_invoke((GIFunctionInfo *) info,
in_args,
n_in_args,
out_args, n_out_args, &retval, &error))
{
+ GITypeTag tag;
+
type_info = g_callable_info_get_return_type((GICallableInfo *) info);
- if (g_type_info_get_tag(type_info) == GI_TYPE_TAG_VOID)
+ tag = g_type_info_get_tag(type_info);
+ if (tag == GI_TYPE_TAG_VOID)
retval_ref = JSValueMakeNull(eng->context);
else
{
+ GIBaseInfo * interface;
+ GIInfoType type;
+
+ if (tag == GI_TYPE_TAG_INTERFACE)
+ {
+ GIFunctionInfoFlags flags =
+ g_function_info_get_flags((GIFunctionInfo *) info);
+
+ if (flags & GI_FUNCTION_IS_CONSTRUCTOR)
+ {
+ GIBaseInfo * interface;
+ GIInfoType interface_type;
+
+ interface = g_type_info_get_interface(type_info);
+ interface_type = g_base_info_get_type(interface);
+ g_base_info_unref(interface);
+
+ if (interface_type == GI_INFO_TYPE_OBJECT ||
+ interface_type == GI_INFO_TYPE_INTERFACE)
+ {
+ if (G_IS_OBJECT(retval.v_pointer))
+ g_object_ref_sink(G_OBJECT(retval.v_pointer));
+ }
+
+ }
+ }
+
+
retval_ref =
seed_gi_argument_make_js(&retval, type_info, exception);
Modified: trunk/libseed/seed-types.c
==============================================================================
--- trunk/libseed/seed-types.c (original)
+++ trunk/libseed/seed-types.c Fri Nov 21 19:07:25 2008
@@ -126,11 +126,16 @@
g_registered_type_info_get_g_type(
(GIRegisteredTypeInfo*)interface_info);
-// TODO: Need to fix a broken reference somewhere for this not to break things.
-// Possibly related to subclassing and the two phase destruction process.
-// if (g_type_is_a(gtype, G_TYPE_OBJECT)
-// || g_type_is_a(gtype, G_TYPE_INTERFACE))
-// g_object_unref(G_OBJECT(arg->v_pointer));
+ if (g_type_is_a(gtype, G_TYPE_OBJECT)
+ || g_type_is_a(gtype, G_TYPE_INTERFACE))
+ {
+ SEED_NOTE(MISC,
+ "Unreffing object of type: %s in"
+ "argument release. Reference count: %d\n",
+ g_type_name(G_OBJECT_TYPE(G_OBJECT(arg->v_pointer))),
+ G_OBJECT(arg->v_pointer)->ref_count);
+ g_object_unref(G_OBJECT(arg->v_pointer));
+ }
g_base_info_unref(interface_info);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]