[Swfdec-commits] 10 commits - swfdec/swfdec_actor.c swfdec/swfdec_as_context.c swfdec/swfdec_as_context.h swfdec/swfdec_as_function.c swfdec/swfdec_as_internal.h swfdec/swfdec_as_native_function.c swfdec/swfdec_as_object.c swfdec/swfdec_as_script_function.c swfdec/swfdec_interval.c swfdec/swfdec_interval.h swfdec/swfdec_movie.c swfdec/swfdec_player_as.c swfdec/swfdec_player.c swfdec/swfdec_resource.c swfdec/swfdec_resource.h swfdec/swfdec_sandbox.c swfdec/swfdec_sandbox.h swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_system_security.c swfdec/swfdec_text_format.c swfdec/swfdec_video_movie.c swfdec/swfdec_xml_socket.c swfdec/swfdec_xml_socket.h

Benjamin Otte company at kemper.freedesktop.org
Sat Oct 25 14:49:35 PDT 2008


 swfdec/swfdec_actor.c              |    1 
 swfdec/swfdec_as_context.c         |    3 -
 swfdec/swfdec_as_context.h         |    2 -
 swfdec/swfdec_as_function.c        |   63 --------------------------------
 swfdec/swfdec_as_internal.h        |   10 +++--
 swfdec/swfdec_as_native_function.c |   21 ++++++++++
 swfdec/swfdec_as_object.c          |   71 +++++++++++++++++++++++++++----------
 swfdec/swfdec_as_script_function.c |    6 ++-
 swfdec/swfdec_interval.c           |    9 ++--
 swfdec/swfdec_interval.h           |    6 +--
 swfdec/swfdec_movie.c              |    1 
 swfdec/swfdec_player.c             |    1 
 swfdec/swfdec_player_as.c          |   29 ++++++++++-----
 swfdec/swfdec_resource.c           |    2 -
 swfdec/swfdec_resource.h           |    8 ++--
 swfdec/swfdec_sandbox.c            |    9 ----
 swfdec/swfdec_sandbox.h            |    2 -
 swfdec/swfdec_sprite_movie.c       |    1 
 swfdec/swfdec_sprite_movie_as.c    |    1 
 swfdec/swfdec_system_security.c    |    1 
 swfdec/swfdec_text_format.c        |   35 +++++++-----------
 swfdec/swfdec_video_movie.c        |    1 
 swfdec/swfdec_xml_socket.c         |    2 -
 swfdec/swfdec_xml_socket.h         |    6 +--
 24 files changed, 144 insertions(+), 147 deletions(-)

New commits:
commit dd4ae9cb82abacbc33a6694eeb1958c1ddd1635f
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 23:49:00 2008 +0200

    add swfdec_as_native_function_new_bare() and use it
    
    This adds a native function without setting __proto__ and constructor
    variables.

diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index bebbf16..37dc083 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -68,6 +68,13 @@ void		swfdec_as_object_add_native_variable (SwfdecAsObject *	object,
 						 SwfdecAsNative		get,
 						 SwfdecAsNative		set);
 
+/* swfdec_as_native_function.h */
+SwfdecAsFunction *
+		swfdec_as_native_function_new_bare 
+						(SwfdecAsContext *	context,
+						 const char *		name,
+						 SwfdecAsNative		native,
+						 SwfdecAsObject *	prototype);
 /* swfdec_as_array.h */
 void		swfdec_as_array_remove_range	(SwfdecAsObject *	object,
 						 gint32			start_index,
diff --git a/swfdec/swfdec_as_native_function.c b/swfdec/swfdec_as_native_function.c
index 4a22a75..ebe6405 100644
--- a/swfdec/swfdec_as_native_function.c
+++ b/swfdec/swfdec_as_native_function.c
@@ -169,6 +169,26 @@ SwfdecAsFunction *
 swfdec_as_native_function_new (SwfdecAsContext *context, const char *name,
     SwfdecAsNative native, SwfdecAsObject *prototype)
 {
+  SwfdecAsFunction *fun;
+
+  g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
+  g_return_val_if_fail (native != NULL, NULL);
+  g_return_val_if_fail (prototype == NULL || SWFDEC_IS_AS_OBJECT (prototype), NULL);
+
+  fun = swfdec_as_native_function_new_bare (context, name, native, prototype);
+
+  swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (fun),
+      SWFDEC_AS_STR_Function, NULL);
+  swfdec_as_object_set_variable_flags (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR___proto__, 
+      SWFDEC_AS_VARIABLE_VERSION_6_UP);
+
+  return fun;
+}
+
+SwfdecAsFunction *
+swfdec_as_native_function_new_bare (SwfdecAsContext *context, const char *name,
+    SwfdecAsNative native, SwfdecAsObject *prototype)
+{
   SwfdecAsNativeFunction *fun;
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
@@ -186,10 +206,6 @@ swfdec_as_native_function_new (SwfdecAsContext *context, const char *name,
     swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR_prototype, 
 	&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   }
-  swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (fun),
-      SWFDEC_AS_STR_Function, NULL);
-  swfdec_as_object_set_variable_flags (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR___proto__, 
-      SWFDEC_AS_VARIABLE_VERSION_6_UP);
 
   return SWFDEC_AS_FUNCTION (fun);
 }
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 1cd9a94..b46d23f 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -1754,15 +1754,17 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
   SwfdecAsValue val;
 
   /* initialize core objects */
-  object = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global, 
-      SWFDEC_AS_STR_Object, swfdec_as_object_construct));
+  object = SWFDEC_AS_OBJECT (swfdec_as_native_function_new_bare (context, 
+	SWFDEC_AS_STR_Object, swfdec_as_object_construct, NULL));
   obj_proto = swfdec_as_object_new_empty (context);
-  function = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global,
-      SWFDEC_AS_STR_Function, NULL));
+  function = SWFDEC_AS_OBJECT (swfdec_as_native_function_new_bare (context, 
+      SWFDEC_AS_STR_Function, swfdec_as_object_do_nothing, NULL));
   fun_proto = swfdec_as_object_new_empty (context);
 
   /* initialize Function */
-  swfdec_as_object_set_variable_flags (context->global, SWFDEC_AS_STR_Function, SWFDEC_AS_VARIABLE_VERSION_6_UP);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+  swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_Function, &val,
+      SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT | SWFDEC_AS_VARIABLE_VERSION_6_UP);
   SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
   swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_constructor,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -1784,6 +1786,9 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
 
 
   /* initialize Object */
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
+  swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_Object, &val,
+      SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   context->Object = object;
   SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
diff --git a/swfdec/swfdec_player_as.c b/swfdec/swfdec_player_as.c
index 0809ac9..c780239 100644
--- a/swfdec/swfdec_player_as.c
+++ b/swfdec/swfdec_player_as.c
@@ -346,13 +346,24 @@ swfdec_player_object_registerClass (SwfdecAsContext *cx, SwfdecAsObject *object,
 void
 swfdec_player_preinit_global (SwfdecAsContext *context)
 {
-  /* init these two before swfdec_as_context_startup, so they won't get
-   * __proto__ and constructor properties */
-  swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_ASnative, 
-      swfdec_player_ASnative);
-  swfdec_as_object_add_function (context->global, SWFDEC_AS_STR_ASconstructor,
-      swfdec_player_ASconstructor);
-  // FIXME: is this only the debug player?
-  swfdec_as_object_add_function (context->global,
-      SWFDEC_AS_STR_enableDebugConsole, swfdec_player_enableDebugConsole);
+  SwfdecAsObject *o;
+  SwfdecAsValue val;
+
+  o = SWFDEC_AS_OBJECT (swfdec_as_native_function_new_bare (context,
+	SWFDEC_AS_STR_ASnative, swfdec_player_ASnative, NULL));
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
+  swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASnative,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+
+  o = SWFDEC_AS_OBJECT (swfdec_as_native_function_new_bare (context,
+	SWFDEC_AS_STR_ASconstructor, swfdec_player_ASconstructor, NULL));
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
+  swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_ASconstructor,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+
+  o = SWFDEC_AS_OBJECT (swfdec_as_native_function_new_bare (context,
+	SWFDEC_AS_STR_enableDebugConsole, swfdec_player_enableDebugConsole, NULL));
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, o);
+  swfdec_as_object_set_variable_and_flags (context->global, SWFDEC_AS_STR_enableDebugConsole,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
 }
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 243e7e0..4626427 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -27,8 +27,9 @@
 #include <pango/pangocairo.h>
 
 #include "swfdec_text_format.h"
-#include "swfdec_as_native_function.h"
 #include "swfdec_as_array.h"
+#include "swfdec_as_internal.h"
+#include "swfdec_as_native_function.h"
 #include "swfdec_as_object.h"
 #include "swfdec_as_strings.h"
 #include "swfdec_debug.h"
@@ -1044,15 +1045,8 @@ swfdec_text_format_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
   swfdec_text_format_clear (format);
   swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (format));
 
-  // FIXME: Need better way to create function without prototype/constructor
-  function = SWFDEC_AS_OBJECT (swfdec_as_native_function_new (cx, 
+  function = SWFDEC_AS_OBJECT (swfdec_as_native_function_new_bare (cx, 
 	SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL));
-  swfdec_as_object_unset_variable_flags (function, SWFDEC_AS_STR_constructor, 
-      SWFDEC_AS_VARIABLE_PERMANENT);
-  swfdec_as_object_delete_variable (function, SWFDEC_AS_STR_constructor);
-  swfdec_as_object_unset_variable_flags (function, SWFDEC_AS_STR___proto__, 
-      SWFDEC_AS_VARIABLE_PERMANENT);
-  swfdec_as_object_delete_variable (function, SWFDEC_AS_STR___proto__);
   SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
   swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
 
commit 092d268481b02788c38cf31d4bd597ceb33f9f7b
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 23:20:57 2008 +0200

    get rid of context->Function and context->Function_prototype

diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 27baa12..e690636 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -374,8 +374,6 @@ swfdec_as_context_do_mark (SwfdecAsContext *context)
   /* This if is needed for SwfdecPlayer */
   if (context->global) {
     swfdec_gc_object_mark (context->global);
-    swfdec_gc_object_mark (context->Function);
-    swfdec_gc_object_mark (context->Function_prototype);
     swfdec_gc_object_mark (context->Object);
     swfdec_gc_object_mark (context->Object_prototype);
   }
diff --git a/swfdec/swfdec_as_context.h b/swfdec/swfdec_as_context.h
index f3f41ee..079e6fd 100644
--- a/swfdec/swfdec_as_context.h
+++ b/swfdec/swfdec_as_context.h
@@ -76,8 +76,6 @@ struct _SwfdecAsContext {
   SwfdecAsStack *	stack;		/* current stack */
 
   /* magic objects - initialized during swfdec_as_context_startup() */
-  SwfdecAsObject *	Function;	/* Function */
-  SwfdecAsObject *	Function_prototype;	/* Function.prototype */
   SwfdecAsObject *	Object;		/* Object */
   SwfdecAsObject *	Object_prototype;	/* Object.prototype */
 
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 353fb2a..1cd9a94 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -1763,7 +1763,6 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
 
   /* initialize Function */
   swfdec_as_object_set_variable_flags (context->global, SWFDEC_AS_STR_Function, SWFDEC_AS_VARIABLE_VERSION_6_UP);
-  context->Function = function;
   SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
   swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_constructor,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -1775,7 +1774,6 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
       SWFDEC_AS_VARIABLE_VERSION_6_UP);
 
   /* initialize Function.prototype */
-  context->Function_prototype = fun_proto;
   SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
   swfdec_as_object_set_variable_and_flags (fun_proto, SWFDEC_AS_STR_constructor,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
diff --git a/swfdec/swfdec_sandbox.c b/swfdec/swfdec_sandbox.c
index 256bd50..6381128 100644
--- a/swfdec/swfdec_sandbox.c
+++ b/swfdec/swfdec_sandbox.c
@@ -51,8 +51,6 @@ swfdec_sandbox_mark (SwfdecGcObject *object)
 {
   SwfdecSandbox *sandbox = SWFDEC_SANDBOX (object);
 
-  swfdec_gc_object_mark (sandbox->Function);
-  swfdec_gc_object_mark (sandbox->Function_prototype);
   swfdec_gc_object_mark (sandbox->Object);
   swfdec_gc_object_mark (sandbox->Object_prototype);
   swfdec_gc_object_mark (sandbox->MovieClip);
@@ -108,8 +106,6 @@ swfdec_sandbox_initialize (SwfdecSandbox *sandbox, guint version)
   swfdec_as_context_run_init_script (context, swfdec_initialize, 
       sizeof (swfdec_initialize), version);
 
-  sandbox->Function = context->Function;
-  sandbox->Function_prototype = context->Function_prototype;
   sandbox->Object = context->Object;
   sandbox->Object_prototype = context->Object_prototype;
 
@@ -219,7 +215,6 @@ swfdec_sandbox_get_for_url (SwfdecPlayer *player, const SwfdecURL *url,
     swfdec_sandbox_initialize (sandbox, flash_version);
   }
 
-
   return sandbox;
 }
 
@@ -245,8 +240,6 @@ swfdec_sandbox_use (SwfdecSandbox *sandbox)
   priv = SWFDEC_PLAYER (context)->priv;
   context->global = SWFDEC_AS_OBJECT (sandbox);
 
-  context->Function = sandbox->Function;
-  context->Function_prototype = sandbox->Function_prototype;
   context->Object = sandbox->Object;
   context->Object_prototype = sandbox->Object_prototype;
 }
@@ -293,8 +286,6 @@ swfdec_sandbox_unuse (SwfdecSandbox *sandbox)
 
   context = swfdec_gc_object_get_context (sandbox);
   context->global = NULL;
-  context->Function = NULL;
-  context->Function_prototype = NULL;
   context->Object = NULL;
   context->Object_prototype = NULL;
 }
diff --git a/swfdec/swfdec_sandbox.h b/swfdec/swfdec_sandbox.h
index 3257649..832b7fc 100644
--- a/swfdec/swfdec_sandbox.h
+++ b/swfdec/swfdec_sandbox.h
@@ -54,8 +54,6 @@ struct _SwfdecSandbox
   guint			as_version;		/* Actionscript version */
 
   /* global cached objects from context */
-  SwfdecAsObject *	Function;		/* Function */
-  SwfdecAsObject *	Function_prototype;	/* Function.prototype */
   SwfdecAsObject *	Object;			/* Object */
   SwfdecAsObject *	Object_prototype;	/* Object.prototype */
 
commit 6744debc76c05d33d4f1b80d5944017235131a45
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 23:20:24 2008 +0200

    create a bare function without context->Function to create a new

diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index c2d6824..243e7e0 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -1080,9 +1080,9 @@ swfdec_text_format_copy (SwfdecTextFormat *copy_from)
 SwfdecTextFormat *
 swfdec_text_format_new_no_properties (SwfdecAsContext *context)
 {
-  SwfdecAsObject *tmp, *object;
+  SwfdecAsObject *object;
   SwfdecTextFormat *ret;
-  SwfdecAsFunction *function;
+  SwfdecAsObject *function;
   SwfdecAsValue val;
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
@@ -1095,11 +1095,12 @@ swfdec_text_format_new_no_properties (SwfdecAsContext *context)
   swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (ret));
 
   // FIXME: Need better way to create function without prototype/constructor
-  tmp = context->Function;
-  context->Function = NULL;
-  function = swfdec_as_native_function_new (context, SWFDEC_AS_STR_getTextExtent,
-      swfdec_text_format_getTextExtent, NULL);
-  context->Function = tmp;
+  function = SWFDEC_AS_OBJECT (swfdec_as_native_function_new (context, 
+	SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL));
+  swfdec_as_object_unset_variable_flags (function, SWFDEC_AS_STR_constructor, SWFDEC_AS_VARIABLE_PERMANENT);
+  swfdec_as_object_unset_variable_flags (function, SWFDEC_AS_STR___proto__, SWFDEC_AS_VARIABLE_PERMANENT);
+  swfdec_as_object_delete_variable (function, SWFDEC_AS_STR_constructor);
+  swfdec_as_object_delete_variable (function, SWFDEC_AS_STR___proto__);
   if (function != NULL) {
     SWFDEC_AS_VALUE_SET_OBJECT (&val, SWFDEC_AS_OBJECT (function));
     swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
commit 50f0fb6ec89c8cbf8a7818898037d34cf716f3a8
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 23:01:52 2008 +0200

    merge swfdec_as_function_init_context() into swfdec_as_object_init_context()
    
    This increases clarity for the initialization of the main objects quite
    a bit.

diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 6726536..27baa12 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -1198,7 +1198,6 @@ swfdec_as_context_startup (SwfdecAsContext *context)
   /* FIXME: remove them for normal contexts? */
   swfdec_player_preinit_global (context);
   /* get the necessary objects up to define objects and functions sanely */
-  swfdec_as_function_init_context (context);
   swfdec_as_object_init_context (context);
   /* define the global object and other important ones */
   swfdec_as_context_init_global (context);
diff --git a/swfdec/swfdec_as_function.c b/swfdec/swfdec_as_function.c
index ab6ed09..8d4c2ee 100644
--- a/swfdec/swfdec_as_function.c
+++ b/swfdec/swfdec_as_function.c
@@ -175,31 +175,3 @@ swfdec_as_function_apply (SwfdecAsContext *cx, SwfdecAsObject *object,
   }
 }
 
-void
-swfdec_as_function_init_context (SwfdecAsContext *context)
-{
-  SwfdecAsObject *function, *proto;
-  SwfdecAsValue val;
-
-  g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
-
-  function = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global,
-      SWFDEC_AS_STR_Function, NULL));
-  swfdec_as_object_set_variable_flags (context->global, SWFDEC_AS_STR_Function, SWFDEC_AS_VARIABLE_VERSION_6_UP);
-  context->Function = function;
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
-  swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_constructor,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-  proto = swfdec_as_object_new_empty (context);
-  context->Function_prototype = proto;
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
-  swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_prototype,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-  swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR___proto__,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_VERSION_6_UP);
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
-  swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-}
-
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 1799d84..bebbf16 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -34,8 +34,6 @@ G_BEGIN_DECLS
 
 #define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
 
-void		swfdec_as_function_init_context		(SwfdecAsContext *	context);
-
 /* swfdec_as_context.c */
 gboolean	swfdec_as_context_check_continue (SwfdecAsContext *	context);
 void		swfdec_as_context_run		(SwfdecAsContext *	context);
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 9f9d691..353fb2a 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -1750,28 +1750,59 @@ swfdec_as_object_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
 void
 swfdec_as_object_init_context (SwfdecAsContext *context)
 {
+  SwfdecAsObject *function, *fun_proto, *object, *obj_proto;
   SwfdecAsValue val;
-  SwfdecAsObject *object, *proto;
 
-  proto = swfdec_as_object_new_empty (context);
+  /* initialize core objects */
   object = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global, 
       SWFDEC_AS_STR_Object, swfdec_as_object_construct));
-  context->Object = object;
-  context->Object_prototype = proto;
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, proto);
-  /* first, set our own */
-  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
+  obj_proto = swfdec_as_object_new_empty (context);
+  function = SWFDEC_AS_OBJECT (swfdec_as_object_add_function (context->global,
+      SWFDEC_AS_STR_Function, NULL));
+  fun_proto = swfdec_as_object_new_empty (context);
+
+  /* initialize Function */
+  swfdec_as_object_set_variable_flags (context->global, SWFDEC_AS_STR_Function, SWFDEC_AS_VARIABLE_VERSION_6_UP);
+  context->Function = function;
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+  swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_constructor,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_proto);
+  swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR_prototype,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  swfdec_as_object_set_variable_and_flags (function, SWFDEC_AS_STR___proto__,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_CONSTANT);
+      SWFDEC_AS_VARIABLE_VERSION_6_UP);
 
-  /* then finish the function prototype (use this order or 
-   * SWFDEC_AS_VARIABLE_CONSTANT won't let us */
-  swfdec_as_object_set_variable_and_flags (context->Function_prototype,
+  /* initialize Function.prototype */
+  context->Function_prototype = fun_proto;
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+  swfdec_as_object_set_variable_and_flags (fun_proto, SWFDEC_AS_STR_constructor,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, obj_proto);
+  swfdec_as_object_set_variable_and_flags (fun_proto,
       SWFDEC_AS_STR___proto__, &val,
       SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
 
+
+  /* initialize Object */
+  context->Object = object;
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, fun_proto);
+  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
+      SWFDEC_AS_VARIABLE_VERSION_6_UP);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, obj_proto);
+  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_prototype,
+      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
+      SWFDEC_AS_VARIABLE_CONSTANT);
+
+  /* initialize Object.prototype */
+  context->Object_prototype = obj_proto;
   SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
-  swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
+  swfdec_as_object_set_variable_and_flags (obj_proto, SWFDEC_AS_STR_constructor,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
 }
 
commit 97a85e52ac99f6c1b4f35d085fcf19a5d2bce4f5
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 22:06:08 2008 +0200

    get rid of swfdec_as_function_set_constructor()
    
    use swfdec_as_object_set_constructor_by_name() instead

diff --git a/swfdec/swfdec_as_function.c b/swfdec/swfdec_as_function.c
index c2e1799..ab6ed09 100644
--- a/swfdec/swfdec_as_function.c
+++ b/swfdec/swfdec_as_function.c
@@ -62,37 +62,6 @@ swfdec_as_function_init (SwfdecAsFunction *function)
 }
 
 /**
- * swfdec_as_function_set_constructor:
- * @fun: a #SwfdecAsFunction
- *
- * Sets the constructor and prototype of @fun. This is a shortcut for calling
- * swfdec_as_object_set_constructor() with the right arguments.
- **/
-void
-swfdec_as_function_set_constructor (SwfdecAsFunction *fun)
-{
-  SwfdecAsContext *context;
-  SwfdecAsObject *object;
-  SwfdecAsValue val;
-
-  g_return_if_fail (SWFDEC_IS_AS_FUNCTION (fun));
-
-  object = SWFDEC_AS_OBJECT (fun);
-  context = swfdec_gc_object_get_context (fun);
-  if (context->Function == NULL)
-    return;
-  
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Function);
-  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, context->Function_prototype);
-  swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR___proto__,
-      &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT |
-      SWFDEC_AS_VARIABLE_VERSION_6_UP);
-}
-
-/**
  * swfdec_as_function_call:
  * @function: the #SwfdecAsFunction to call
  * @thisp: this argument to use for the call or %NULL for none
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index dc7ce23..1799d84 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -34,7 +34,6 @@ G_BEGIN_DECLS
 
 #define SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT 256
 
-void		swfdec_as_function_set_constructor	(SwfdecAsFunction *	fun);
 void		swfdec_as_function_init_context		(SwfdecAsContext *	context);
 
 /* swfdec_as_context.c */
diff --git a/swfdec/swfdec_as_native_function.c b/swfdec/swfdec_as_native_function.c
index 4daea74..4a22a75 100644
--- a/swfdec/swfdec_as_native_function.c
+++ b/swfdec/swfdec_as_native_function.c
@@ -186,7 +186,10 @@ swfdec_as_native_function_new (SwfdecAsContext *context, const char *name,
     swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR_prototype, 
 	&val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
   }
-  swfdec_as_function_set_constructor (SWFDEC_AS_FUNCTION (fun));
+  swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (fun),
+      SWFDEC_AS_STR_Function, NULL);
+  swfdec_as_object_set_variable_flags (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR___proto__, 
+      SWFDEC_AS_VARIABLE_VERSION_6_UP);
 
   return SWFDEC_AS_FUNCTION (fun);
 }
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 92f7dc8..9f9d691 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -1343,7 +1343,7 @@ swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object,
 {
   SwfdecAsContext *context;
   SwfdecAsObject *cur;
-  SwfdecAsValue val;
+  SwfdecAsValue *val;
 
   g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
   g_return_val_if_fail (name != NULL, NULL);
@@ -1351,12 +1351,13 @@ swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object,
   context = swfdec_gc_object_get_context (object);
   cur = context->global;
   do {
-    if (!swfdec_as_object_get_variable (cur, name, &val) || 
-	!SWFDEC_AS_VALUE_IS_OBJECT (&val)) {
+    val = swfdec_as_object_peek_variable (cur, name);
+    if (val == NULL ||
+	!SWFDEC_AS_VALUE_IS_OBJECT (val)) {
       SWFDEC_WARNING ("could not find constructor %s", name);
       return NULL;
     }
-    cur = SWFDEC_AS_VALUE_GET_OBJECT (&val);
+    cur = SWFDEC_AS_VALUE_GET_OBJECT (val);
     name = va_arg (args, const char *);
   } while (name != NULL);
   swfdec_as_object_set_constructor (object, cur);
diff --git a/swfdec/swfdec_as_script_function.c b/swfdec/swfdec_as_script_function.c
index 65ec4a0..873c516 100644
--- a/swfdec/swfdec_as_script_function.c
+++ b/swfdec/swfdec_as_script_function.c
@@ -175,7 +175,10 @@ swfdec_as_script_function_new (SwfdecAsObject *target, const GSList *scope_chain
   fun->scope_chain = g_slist_copy ((GSList *) scope_chain);
   fun->script = script;
   fun->target = target;
-  swfdec_as_function_set_constructor (SWFDEC_AS_FUNCTION (fun));
+  swfdec_as_object_set_constructor_by_name (SWFDEC_AS_OBJECT (fun),
+      SWFDEC_AS_STR_Function, NULL);
+  swfdec_as_object_set_variable_flags (SWFDEC_AS_OBJECT (fun), SWFDEC_AS_STR___proto__, 
+      SWFDEC_AS_VARIABLE_VERSION_6_UP);
 
   /* if context is a flash player, copy current sandbox for security checking.
    * FIXME: export this somehow? */
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 7ac3b8e..c2d6824 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -1029,8 +1029,7 @@ swfdec_text_format_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
     NULL
   };
   SwfdecTextFormat *format;
-  SwfdecAsFunction *function;
-  SwfdecAsObject *tmp;
+  SwfdecAsObject *function;
   SwfdecAsValue val;
   guint i;
 
@@ -1046,15 +1045,16 @@ swfdec_text_format_construct (SwfdecAsContext *cx, SwfdecAsObject *object,
   swfdec_as_object_set_relay (object, SWFDEC_AS_RELAY (format));
 
   // FIXME: Need better way to create function without prototype/constructor
-  tmp = cx->Function;
-  cx->Function = NULL;
-  function = swfdec_as_native_function_new (cx, SWFDEC_AS_STR_getTextExtent,
-      swfdec_text_format_getTextExtent, NULL);
-  cx->Function = tmp;
-  if (function != NULL) {
-    SWFDEC_AS_VALUE_SET_OBJECT (&val, SWFDEC_AS_OBJECT (function));
-    swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
-  }
+  function = SWFDEC_AS_OBJECT (swfdec_as_native_function_new (cx, 
+	SWFDEC_AS_STR_getTextExtent, swfdec_text_format_getTextExtent, NULL));
+  swfdec_as_object_unset_variable_flags (function, SWFDEC_AS_STR_constructor, 
+      SWFDEC_AS_VARIABLE_PERMANENT);
+  swfdec_as_object_delete_variable (function, SWFDEC_AS_STR_constructor);
+  swfdec_as_object_unset_variable_flags (function, SWFDEC_AS_STR___proto__, 
+      SWFDEC_AS_VARIABLE_PERMANENT);
+  swfdec_as_object_delete_variable (function, SWFDEC_AS_STR___proto__);
+  SWFDEC_AS_VALUE_SET_OBJECT (&val, function);
+  swfdec_as_object_set_variable (object, SWFDEC_AS_STR_getTextExtent, &val);
 
   for (i = 0; i < argc && arguments[i] != NULL; i++) {
     swfdec_as_object_set_variable (object, arguments[i], &argv[i]);
commit 67de886170b8b65e5d5f5c9fc82808a7faa5ef93
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 21:36:32 2008 +0200

    remove outdated documentation

diff --git a/swfdec/swfdec_as_function.c b/swfdec/swfdec_as_function.c
index 1cb573d..c2e1799 100644
--- a/swfdec/swfdec_as_function.c
+++ b/swfdec/swfdec_as_function.c
@@ -42,10 +42,6 @@ G_DEFINE_ABSTRACT_TYPE (SwfdecAsFunction, swfdec_as_function, SWFDEC_TYPE_AS_OBJ
  * If you want to create your own functions, you should create native functions.
  * The easiest way to do this is with swfdec_as_object_add_function() or
  * swfdec_as_native_function_new().
- *
- * In Actionscript, every function can be used as a constructor. If you want to
- * make a native function be used as a constructor for your own #SwfdecAsObject
- * subclass, have a look at swfdec_as_native_function_set_construct_type().
  */
 
 /**
commit 5d272fc6531a309bcb04673575f93dfc411fa3bd
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 21:36:21 2008 +0200

    set constructor earlier

diff --git a/swfdec/swfdec_as_script_function.c b/swfdec/swfdec_as_script_function.c
index 59052c5..65ec4a0 100644
--- a/swfdec/swfdec_as_script_function.c
+++ b/swfdec/swfdec_as_script_function.c
@@ -175,6 +175,7 @@ swfdec_as_script_function_new (SwfdecAsObject *target, const GSList *scope_chain
   fun->scope_chain = g_slist_copy ((GSList *) scope_chain);
   fun->script = script;
   fun->target = target;
+  swfdec_as_function_set_constructor (SWFDEC_AS_FUNCTION (fun));
 
   /* if context is a flash player, copy current sandbox for security checking.
    * FIXME: export this somehow? */
@@ -187,7 +188,7 @@ swfdec_as_script_function_new (SwfdecAsObject *target, const GSList *scope_chain
   swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (fun),
       SWFDEC_AS_STR_prototype, &val,
       SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
-  swfdec_as_function_set_constructor (SWFDEC_AS_FUNCTION (fun));
+
   SWFDEC_AS_VALUE_SET_OBJECT (&val, SWFDEC_AS_OBJECT (fun));
   swfdec_as_object_set_variable_and_flags (proto, SWFDEC_AS_STR_constructor,
       &val, SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
commit 3a92a5be649e6c136145bb8502fb2be5979d60b7
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 19:26:56 2008 +0200

    make SwfdecResource a GcObject
    
    also fix up headers while at it

diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index 1832f64..b299818 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -27,6 +27,7 @@
 #include "swfdec_button_movie.h"
 #include "swfdec_player_internal.h"
 #include "swfdec_resource.h"
+#include "swfdec_sandbox.h"
 #include "swfdec_sprite_movie.h"
 
 
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index cb92ab4..5801180 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -43,6 +43,7 @@
 #include "swfdec_sprite_movie.h"
 #include "swfdec_renderer_internal.h"
 #include "swfdec_resource.h"
+#include "swfdec_sandbox.h"
 #include "swfdec_system.h"
 #include "swfdec_text_field_movie.h"
 #include "swfdec_utils.h"
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 9cbe483..53d33e1 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -42,6 +42,7 @@
 #include "swfdec_movie.h"
 #include "swfdec_renderer_internal.h"
 #include "swfdec_resource.h"
+#include "swfdec_sandbox.h"
 #include "swfdec_script_internal.h"
 #include "swfdec_sprite_movie.h"
 #include "swfdec_text_field_movie.h"
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index c14fa6f..6b8ffd6 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -46,7 +46,7 @@
 
 
 static void swfdec_resource_stream_target_init (SwfdecStreamTargetInterface *iface);
-G_DEFINE_TYPE_WITH_CODE (SwfdecResource, swfdec_resource, SWFDEC_TYPE_AS_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (SwfdecResource, swfdec_resource, SWFDEC_TYPE_GC_OBJECT,
     G_IMPLEMENT_INTERFACE (SWFDEC_TYPE_STREAM_TARGET, swfdec_resource_stream_target_init))
 
 /*** SWFDEC_STREAM_TARGET interface ***/
diff --git a/swfdec/swfdec_resource.h b/swfdec/swfdec_resource.h
index 8a4e2e5..2b88d83 100644
--- a/swfdec/swfdec_resource.h
+++ b/swfdec/swfdec_resource.h
@@ -1,5 +1,5 @@
 /* Swfdec
- * Copyright (C) 2006-2007 Benjamin Otte <otte at gnome.org>
+ * Copyright (C) 2006-2008 Benjamin Otte <otte at gnome.org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -20,8 +20,8 @@
 #ifndef _SWFDEC_RESOURCE_H_
 #define _SWFDEC_RESOURCE_H_
 
+#include <swfdec/swfdec_gc_object.h>
 #include <swfdec/swfdec_player.h>
-#include <swfdec/swfdec_sandbox.h>
 #include <swfdec/swfdec_sprite_movie.h>
 
 G_BEGIN_DECLS
@@ -45,7 +45,7 @@ typedef enum {
 
 struct _SwfdecResource
 {
-  SwfdecAsObject      	object;
+  SwfdecGcObject      	object;
 
   guint			version;	/* version of this resource */
   SwfdecSandbox *	sandbox;	/* sandbox this resource belongs to (only NULL for a short time on very first loader) */
@@ -67,7 +67,7 @@ struct _SwfdecResource
 
 struct _SwfdecResourceClass
 {
-  SwfdecAsObjectClass 	object_class;
+  SwfdecGcObjectClass 	object_class;
 };
 
 GType		swfdec_resource_get_type	  	(void);
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index 20d65f0..153defe 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -35,6 +35,7 @@
 #include "swfdec_script_internal.h"
 #include "swfdec_sprite.h"
 #include "swfdec_resource.h"
+#include "swfdec_sandbox.h"
 #include "swfdec_tag.h"
 
 /*** SWFDEC_SPRITE_MOVIE ***/
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index c146ca4..36266a6 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -34,6 +34,7 @@
 #include "swfdec_filter.h"
 #include "swfdec_internal.h"
 #include "swfdec_player_internal.h"
+#include "swfdec_sandbox.h"
 #include "swfdec_sprite.h"
 #include "swfdec_sprite_movie.h"
 #include "swfdec_swf_decoder.h"
diff --git a/swfdec/swfdec_system_security.c b/swfdec/swfdec_system_security.c
index 404f689..7bc19f2 100644
--- a/swfdec/swfdec_system_security.c
+++ b/swfdec/swfdec_system_security.c
@@ -27,6 +27,7 @@
 #include "swfdec_resource.h"
 #include "swfdec_player_internal.h"
 #include "swfdec_policy_file.h"
+#include "swfdec_sandbox.h"
 
 // properties
 SWFDEC_AS_NATIVE (12, 0, swfdec_system_security_allowDomain)
diff --git a/swfdec/swfdec_video_movie.c b/swfdec/swfdec_video_movie.c
index 01d2688..73176f2 100644
--- a/swfdec/swfdec_video_movie.c
+++ b/swfdec/swfdec_video_movie.c
@@ -27,6 +27,7 @@
 #include "swfdec_player_internal.h"
 #include "swfdec_resource.h"
 #include "swfdec_renderer_internal.h"
+#include "swfdec_sandbox.h"
 #include "swfdec_utils.h"
 #include "swfdec_video_provider.h"
 #include "swfdec_video_video_provider.h"
commit 8d16f211e89d0c86927460907b6a8654480ad863
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 18:54:32 2008 +0200

    make intervals GCObjects, too

diff --git a/swfdec/swfdec_interval.c b/swfdec/swfdec_interval.c
index dd0c390..22523d8 100644
--- a/swfdec/swfdec_interval.c
+++ b/swfdec/swfdec_interval.c
@@ -33,7 +33,7 @@
 #include "swfdec_player_internal.h"
 #include "swfdec_resource.h"
 
-G_DEFINE_TYPE (SwfdecInterval, swfdec_interval, SWFDEC_TYPE_AS_OBJECT)
+G_DEFINE_TYPE (SwfdecInterval, swfdec_interval, SWFDEC_TYPE_GC_OBJECT)
 
 static void
 swfdec_interval_mark (SwfdecGcObject *object)
@@ -56,9 +56,10 @@ static void
 swfdec_interval_dispose (GObject *object)
 {
   SwfdecInterval *interval = SWFDEC_INTERVAL (object);
+  SwfdecAsContext *cx = swfdec_gc_object_get_context (interval);
 
   if (interval->n_args) {
-    swfdec_as_context_unuse_mem (swfdec_gc_object_get_context (interval),
+    swfdec_as_context_unuse_mem (cx,
 	interval->n_args * sizeof (SwfdecAsValue));
     g_free (interval->args);
     interval->args = NULL;
@@ -66,7 +67,7 @@ swfdec_interval_dispose (GObject *object)
   }
   /* needed here when GC'ed by closing the player */
   if (interval->timeout.callback != NULL) {
-    swfdec_player_remove_timeout (SWFDEC_PLAYER (swfdec_gc_object_get_context (object)), &interval->timeout);
+    swfdec_player_remove_timeout (SWFDEC_PLAYER (cx), &interval->timeout);
     interval->timeout.callback = NULL;
   }
 
@@ -100,7 +101,7 @@ swfdec_interval_trigger (SwfdecTimeout *timeout)
 
   if (interval->repeat) {
     timeout->timestamp += SWFDEC_MSECS_TO_TICKS (interval->msecs);
-    swfdec_player_add_timeout (SWFDEC_PLAYER (context), timeout);
+    swfdec_player_add_timeout (player, timeout);
   } else {
     player->priv->intervals = g_list_remove (player->priv->intervals, interval);
     interval->timeout.callback = NULL;
diff --git a/swfdec/swfdec_interval.h b/swfdec/swfdec_interval.h
index 8e82511..30838cb 100644
--- a/swfdec/swfdec_interval.h
+++ b/swfdec/swfdec_interval.h
@@ -20,8 +20,8 @@
 #ifndef _SWFDEC_INTERVAL_H_
 #define _SWFDEC_INTERVAL_H_
 
-#include <swfdec/swfdec_as_object.h>
 #include <swfdec/swfdec_as_types.h>
+#include <swfdec/swfdec_gc_object.h>
 #include <swfdec/swfdec_player_internal.h>
 #include <swfdec/swfdec_sandbox.h>
 
@@ -38,7 +38,7 @@ typedef struct _SwfdecIntervalClass SwfdecIntervalClass;
 #define SWFDEC_INTERVAL_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_INTERVAL, SwfdecIntervalClass))
 
 struct _SwfdecInterval {
-  SwfdecAsObject	asobject;
+  SwfdecGcObject	gc_object;
 
   SwfdecTimeout		timeout;
   SwfdecSandbox *	sandbox;	/* sandbox we run the script in */
@@ -54,7 +54,7 @@ struct _SwfdecInterval {
 };
 
 struct _SwfdecIntervalClass {
-  SwfdecAsObjectClass	asobject_class;
+  SwfdecGcObjectClass	gc_object_class;
 };
 
 GType		swfdec_interval_get_type	(void);
commit 395704fe462fdfde6939789daf1882b3dfcf880a
Author: Benjamin Otte <otte at gnome.org>
Date:   Sat Oct 25 18:43:18 2008 +0200

    make XmlSocket a GcObject

diff --git a/swfdec/swfdec_xml_socket.c b/swfdec/swfdec_xml_socket.c
index 64f7a2e..cde5f1e 100644
--- a/swfdec/swfdec_xml_socket.c
+++ b/swfdec/swfdec_xml_socket.c
@@ -163,7 +163,7 @@ swfdec_xml_socket_stream_target_init (SwfdecStreamTargetInterface *iface)
 
 /*** SWFDEC_XML_SOCKET ***/
 
-G_DEFINE_TYPE_WITH_CODE (SwfdecXmlSocket, swfdec_xml_socket, SWFDEC_TYPE_AS_OBJECT,
+G_DEFINE_TYPE_WITH_CODE (SwfdecXmlSocket, swfdec_xml_socket, SWFDEC_TYPE_GC_OBJECT,
     G_IMPLEMENT_INTERFACE (SWFDEC_TYPE_STREAM_TARGET, swfdec_xml_socket_stream_target_init))
 
 static void
diff --git a/swfdec/swfdec_xml_socket.h b/swfdec/swfdec_xml_socket.h
index 73ac1f9..66bff6e 100644
--- a/swfdec/swfdec_xml_socket.h
+++ b/swfdec/swfdec_xml_socket.h
@@ -21,7 +21,7 @@
 #define _SWFDEC_XML_SOCKET_H_
 
 #include <swfdec/swfdec.h>
-#include <swfdec/swfdec_as_object.h>
+#include <swfdec/swfdec_gc_object.h>
 #include <swfdec/swfdec_sandbox.h>
 
 G_BEGIN_DECLS
@@ -38,7 +38,7 @@ typedef struct _SwfdecXmlSocketClass SwfdecXmlSocketClass;
 #define SWFDEC_XML_SOCKET_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_XML_SOCKET, SwfdecXmlSocketClass))
 
 struct _SwfdecXmlSocket {
-  SwfdecAsObject	object;
+  SwfdecGcObject	object;
 
   SwfdecSocket *	socket;		/* the socket in use */
   SwfdecSandbox *	sandbox;	/* the sandbox we run in */
@@ -49,7 +49,7 @@ struct _SwfdecXmlSocket {
 };
 
 struct _SwfdecXmlSocketClass {
-  SwfdecAsObjectClass	object_class;
+  SwfdecGcObjectClass	object_class;
 };
 
 GType		swfdec_xml_socket_get_type	(void);


More information about the Swfdec-commits mailing list