[Swfdec-commits] 7 commits - doc/swfdec.types swfdec/swfdec_as_array.c swfdec/swfdec_as_context.c swfdec/swfdec_as_context.h swfdec/swfdec_as_frame.c swfdec/swfdec_as_function.c swfdec/swfdec_as_internal.h swfdec/swfdec_as_interpret.c swfdec/swfdec_as_object.c swfdec/swfdec_as_object.h swfdec/swfdec_as_relay.c swfdec/swfdec_as_script_function.c swfdec/swfdec_as_super.c swfdec/swfdec_as_types.c swfdec/swfdec_as_types.h swfdec/swfdec_bitmap_data.c swfdec/swfdec_button.c swfdec/swfdec_color_as.c swfdec/swfdec_event.c swfdec/swfdec_filter.h swfdec/swfdec_gc_object.c swfdec/swfdec_gc_object.h swfdec/swfdec_load_object_as.c swfdec/swfdec_load_sound.c swfdec/swfdec_movie_as_drawing.c swfdec/swfdec_movie.c swfdec/swfdec_player.c swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_style_sheet.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_field_movie_html.c swfdec/swfdec_text_format.c swfdec/swfdec_utils.c swfdec/swfdec_xml_node.c swfdec/swfdec_xml_node.h swfdec/swfdec_xml_socket.c test/various

Benjamin Otte company at kemper.freedesktop.org
Wed Nov 5 14:16:13 PST 2008


 doc/swfdec.types                      |    2 
 swfdec/swfdec_as_array.c              |   66 +++++------
 swfdec/swfdec_as_context.c            |   66 +++++------
 swfdec/swfdec_as_context.h            |    5 
 swfdec/swfdec_as_frame.c              |    2 
 swfdec/swfdec_as_function.c           |    2 
 swfdec/swfdec_as_internal.h           |    2 
 swfdec/swfdec_as_interpret.c          |   18 +--
 swfdec/swfdec_as_object.c             |  194 +++++++++++++---------------------
 swfdec/swfdec_as_object.h             |   18 ---
 swfdec/swfdec_as_relay.c              |    2 
 swfdec/swfdec_as_script_function.c    |    2 
 swfdec/swfdec_as_super.c              |    5 
 swfdec/swfdec_as_types.c              |    5 
 swfdec/swfdec_as_types.h              |    5 
 swfdec/swfdec_bitmap_data.c           |    4 
 swfdec/swfdec_button.c                |    4 
 swfdec/swfdec_color_as.c              |    4 
 swfdec/swfdec_event.c                 |    2 
 swfdec/swfdec_filter.h                |    2 
 swfdec/swfdec_gc_object.c             |    3 
 swfdec/swfdec_gc_object.h             |    1 
 swfdec/swfdec_load_object_as.c        |    2 
 swfdec/swfdec_load_sound.c            |    6 -
 swfdec/swfdec_movie.c                 |    2 
 swfdec/swfdec_movie_as_drawing.c      |    4 
 swfdec/swfdec_player.c                |   14 +-
 swfdec/swfdec_sprite_movie_as.c       |    4 
 swfdec/swfdec_style_sheet.c           |    6 -
 swfdec/swfdec_text_field_movie.c      |    2 
 swfdec/swfdec_text_field_movie_html.c |    2 
 swfdec/swfdec_text_format.c           |    2 
 swfdec/swfdec_utils.c                 |    2 
 swfdec/swfdec_xml_node.c              |   10 -
 swfdec/swfdec_xml_node.h              |    2 
 swfdec/swfdec_xml_socket.c            |    6 -
 test/various/Makefile.am              |    6 -
 test/various/gc.c                     |  161 ----------------------------
 38 files changed, 210 insertions(+), 435 deletions(-)

New commits:
commit 719b9318182ed84b0dda6c04a73a4091b73da8d5
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 23:13:47 2008 +0100

    make SwfdecAsObject not be a GObject anymore
    
    Hopefully the testsuite caught all cases where we called
    swfdec_gc_object_mark() or swfdec_gc_object_get_context() on an AsObject
    - they will cause crashes now.
    Go Riccardo! :)

diff --git a/doc/swfdec.types b/doc/swfdec.types
index 20386bf..4dce4cd 100644
--- a/doc/swfdec.types
+++ b/doc/swfdec.types
@@ -5,7 +5,7 @@ swfdec_as_context_get_type
 swfdec_as_debugger_get_type
 swfdec_as_function_get_type
 swfdec_as_native_function_get_type
-swfdec_as_object_get_type
+swfdec_as_relay_get_type
 swfdec_audio_get_type
 swfdec_file_loader_get_type
 swfdec_gc_object_get_type
diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index 720cf2c..c9f7d6d 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -76,7 +76,7 @@ swfdec_as_array_length_as_integer (SwfdecAsObject *object)
   g_return_val_if_fail (object != NULL, 0);
 
   swfdec_as_object_get_variable (object, SWFDEC_AS_STR_length, &val);
-  length = swfdec_as_value_to_integer (swfdec_gc_object_get_context (object), &val);
+  length = swfdec_as_value_to_integer (object->context, &val);
 
   return length;
 }
@@ -115,7 +115,7 @@ swfdec_as_array_set_length_object (SwfdecAsObject *object, gint32 length)
   was_array = object->array;
   object->array = FALSE;
 
-  swfdec_as_value_set_integer (swfdec_gc_object_get_context (object), &val, length);
+  swfdec_as_value_set_integer (object->context, &val, length);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length, &val,
       SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
 
@@ -138,7 +138,7 @@ swfdec_as_array_set_length (SwfdecAsObject *array, gint32 length)
   g_return_if_fail (array != NULL);
   g_return_if_fail (length >= 0);
 
-  swfdec_as_value_set_integer (swfdec_gc_object_get_context (array), &val, length);
+  swfdec_as_value_set_integer (array->context, &val, length);
   swfdec_as_object_set_variable_and_flags (array,
       SWFDEC_AS_STR_length, &val,
       SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
@@ -181,8 +181,8 @@ swfdec_as_array_remove_range (SwfdecAsObject *object, gint32 start_index,
 
   // to avoid foreach loop, use special case when removing just one variable
   if (num == 1) {
-    swfdec_as_object_delete_variable (object, swfdec_as_integer_to_string (
-	  swfdec_gc_object_get_context (object), start_index));
+    swfdec_as_object_delete_variable (object, 
+	swfdec_as_integer_to_string (object->context, start_index));
   } else {
     ForeachRemoveRangeData fdata = { start_index, num };
     swfdec_as_object_foreach_remove (object,
@@ -208,7 +208,7 @@ swfdec_as_array_foreach_move_range (SwfdecAsObject *object,
     return variable;
 
   if (idx >= fdata->start_index && idx < fdata->start_index + fdata->num) {
-    return swfdec_as_integer_to_string (swfdec_gc_object_get_context (object),
+    return swfdec_as_integer_to_string (object->context,
 	fdata->to_index + idx - fdata->start_index);
   } else if (idx >= fdata->to_index && idx < fdata->to_index + fdata->num) {
     return NULL;
@@ -253,7 +253,7 @@ swfdec_as_array_set_range_with_flags (SwfdecAsObject *object,
   g_return_if_fail (num == 0 || value != NULL);
 
   for (i = 0; i < num; i++) {
-    var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (object), start_index + i);
+    var = swfdec_as_integer_to_string (object->context, start_index + i);
     swfdec_as_object_set_variable_and_flags (object, var, &value[i], flags);
   }
 }
@@ -404,7 +404,7 @@ swfdec_as_array_get_value (SwfdecAsObject *array, gint32 idx,
   g_assert (idx >= 0);
   g_assert (value != NULL);
 
-  var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (array), idx);
+  var = swfdec_as_integer_to_string (array->context, idx);
   swfdec_as_object_get_variable (array, var, value);
 }
 
@@ -426,7 +426,7 @@ swfdec_as_array_set_value (SwfdecAsObject *array, gint32 idx,
   g_assert (array != NULL);
   g_assert (idx >= 0);
 
-  var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (array), idx);
+  var = swfdec_as_integer_to_string (array->context, idx);
   swfdec_as_object_set_variable (array, var, value);
 }
 
@@ -447,7 +447,7 @@ swfdec_as_array_foreach_append_array_range (SwfdecAsObject *object,
 
   idx = swfdec_as_array_to_index (variable);
   if (idx >= fdata->start_index && idx < fdata->start_index + fdata->num) {
-    var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (fdata->object_to),
+    var = swfdec_as_integer_to_string (fdata->object_to->context,
 	fdata->offset + (idx - fdata->start_index));
     swfdec_as_object_set_variable (fdata->object_to, var, value);
   }
@@ -602,7 +602,7 @@ swfdec_as_array_do_pop (SwfdecAsContext *cx, SwfdecAsObject *object,
   if (length == 0)
     return;
 
-  var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (object), length - 1);
+  var = swfdec_as_integer_to_string (object->context, length - 1);
   swfdec_as_object_get_variable (object, var, ret);
 
   swfdec_as_object_delete_variable (object, var);
@@ -663,12 +663,12 @@ swfdec_as_array_do_shift (SwfdecAsContext *cx, SwfdecAsObject *object,
     // we have to put the last element back, because we used move, not copy
     SwfdecAsValue val;
     if (length > 1) {
-      var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (object), length - 2);
+      var = swfdec_as_integer_to_string (object->context, length - 2);
       swfdec_as_object_get_variable (object, var, &val);
     } else {
       val = *ret;
     }
-    var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (object), length - 1);
+    var = swfdec_as_integer_to_string (object->context, length - 1);
     swfdec_as_object_set_variable (object, var, &val);
   }
 }
@@ -684,7 +684,7 @@ swfdec_as_array_foreach_reverse (SwfdecAsObject *object, const char *variable,
   if (idx == -1 || idx >= *length)
     return variable;
 
-  return swfdec_as_integer_to_string (swfdec_gc_object_get_context (object), *length - 1 - idx);
+  return swfdec_as_integer_to_string (object->context, *length - 1 - idx);
 }
 
 SWFDEC_AS_NATIVE (252, 11, swfdec_as_array_reverse)
@@ -729,8 +729,7 @@ swfdec_as_array_concat (SwfdecAsContext *cx, SwfdecAsObject *object,
     }
     else
     {
-      var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (object),
-	  swfdec_as_array_get_length (array_new));
+      var = swfdec_as_integer_to_string (cx, swfdec_as_array_get_length (array_new));
       swfdec_as_object_set_variable (array_new, var, &argv[j]);
     }
   }
@@ -860,9 +859,8 @@ swfdec_as_array_sort_compare_values (SwfdecAsContext *cx,
   {
     SwfdecAsValue argv[2] = { *a, *b };
     SwfdecAsValue ret;
-    SwfdecAsContext *context = swfdec_gc_object_get_context (custom_function);
     swfdec_as_function_call (custom_function, NULL, 2, argv, &ret);
-    retval = swfdec_as_value_to_integer (context, &ret);
+    retval = swfdec_as_value_to_integer (cx, &ret);
   }
   else if (options & SORT_OPTION_NUMERIC &&
       (SWFDEC_AS_VALUE_IS_NUMBER (a) ||
diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 30afb28..ccf1857 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -310,6 +310,8 @@ swfdec_as_context_collect (SwfdecAsContext *context)
   
   swfdec_as_context_remove_gc_objects (context);
 
+  context->objects = swfdec_as_gcable_collect (context, context->objects,
+      (SwfdecAsGcableDestroyNotify) swfdec_as_object_free);
   context->strings = swfdec_as_gcable_collect (context, context->strings,
       swfdec_as_context_collect_string);
   context->numbers = swfdec_as_gcable_collect (context, context->numbers,
@@ -350,9 +352,9 @@ swfdec_as_string_mark (const char *string)
 void
 swfdec_as_value_mark (SwfdecAsValue *value)
 {
-
   if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
-    swfdec_gc_object_mark (value->value.object);
+    if (!SWFDEC_AS_GCABLE_FLAG_IS_SET (value->value.gcable, SWFDEC_AS_GC_MARK))
+      swfdec_as_object_mark ((SwfdecAsObject *) value->value.gcable);
   } else if (SWFDEC_AS_VALUE_IS_MOVIE (value)) {
     if (!SWFDEC_AS_GCABLE_FLAG_IS_SET (value->value.gcable, SWFDEC_AS_GC_MARK))
       swfdec_as_movie_value_mark ((SwfdecAsMovieValue *) value->value.gcable);
@@ -382,7 +384,7 @@ swfdec_as_context_do_mark (SwfdecAsContext *context)
 {
   /* This if is needed for SwfdecPlayer */
   if (context->global)
-    swfdec_gc_object_mark (context->global);
+    swfdec_as_object_mark (context->global);
   if (context->exception)
     swfdec_as_value_mark (&context->exception_value);
   g_hash_table_foreach (context->constant_pools, swfdec_as_context_mark_constant_pools, NULL);
diff --git a/swfdec/swfdec_as_context.h b/swfdec/swfdec_as_context.h
index 99c3dc6..b3492f4 100644
--- a/swfdec/swfdec_as_context.h
+++ b/swfdec/swfdec_as_context.h
@@ -58,7 +58,8 @@ struct _SwfdecAsContext {
   gsize			memory_since_gc;/* memory allocated since last GC run */
   GHashTable *		interned_strings;/* string => memory mapping the context manages */
   gpointer		gc_objects;	/* all SwfdecGcObjects the context manages */
-  gpointer		strings;	/* all numbers the context manages */
+  gpointer		objects;	/* all objects the context manages */
+  gpointer		strings;	/* all strings the context manages */
   gpointer		numbers;	/* all numbers the context manages */
   gpointer		movies;		/* all movies the context manages */
   GHashTable *		constant_pools;	/* memory address => SwfdecConstantPool for all gc'ed pools */
diff --git a/swfdec/swfdec_as_internal.h b/swfdec/swfdec_as_internal.h
index 323d3bf..f69a54f 100644
--- a/swfdec/swfdec_as_internal.h
+++ b/swfdec/swfdec_as_internal.h
@@ -82,6 +82,8 @@ typedef SwfdecAsVariableForeach SwfdecAsVariableForeachRemove;
 typedef const char *(* SwfdecAsVariableForeachRename) (SwfdecAsObject *object, 
     const char *variable, SwfdecAsValue *value, guint flags, gpointer data);
 
+void		swfdec_as_object_free		(SwfdecAsContext *	context,
+						 SwfdecAsObject *	object);
 SwfdecAsValue *	swfdec_as_object_peek_variable	(SwfdecAsObject *       object,
 						 const char *		name);
 guint		swfdec_as_object_foreach_remove	(SwfdecAsObject *       object,
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 8a6bbac..4411757 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -752,7 +752,8 @@ swfdec_action_get_member (SwfdecAsContext *cx, guint action, const guint8 *data,
     swfdec_as_object_get_variable (object, name, swfdec_as_stack_peek (cx, 2));
 #ifdef SWFDEC_WARN_MISSING_PROPERTIES
     if (SWFDEC_AS_VALUE_IS_UNDEFINED (swfdec_as_stack_peek (cx, 2))) {
-	SWFDEC_WARNING ("no variable named %s:%s", G_OBJECT_TYPE_NAME (object), name);
+	SWFDEC_WARNING ("no variable named %s:%s", 
+	    object->relay ? G_OBJECT_TYPE_NAME (object->relay) : ":", name);
     }
 #endif
   } else {
@@ -899,7 +900,7 @@ swfdec_action_call_method (SwfdecAsContext *cx, guint action, const guint8 *data
   }
   if (!swfdec_action_call (cx, n_args, super)) {
     SWFDEC_WARNING ("no function named \"%s\" on object %s", name, 
-	obj ? G_OBJECT_TYPE_NAME(obj) : "unknown");
+	obj && obj->relay ? G_OBJECT_TYPE_NAME(obj->relay) : "unknown");
   }
 }
 
@@ -963,7 +964,7 @@ swfdec_action_add2_to_primitive (SwfdecAsValue *value)
     return;
   object = SWFDEC_AS_VALUE_GET_OBJECT (value);
 
-  if (SWFDEC_IS_AS_DATE (object->relay) && swfdec_gc_object_get_context (object)->version > 5)
+  if (SWFDEC_IS_AS_DATE (object->relay) && object->context->version > 5)
     name = SWFDEC_AS_STR_toString;
   else
     name = SWFDEC_AS_STR_valueOf;
@@ -1177,7 +1178,7 @@ swfdec_as_interpret_encode_variables_foreach (SwfdecAsObject *object,
   GString *variables = data;
   char *escaped;
 
-  context = swfdec_gc_object_get_context (object);
+  context = object->context;
   // FIXME: check propflags?
 
   if (variables->len > 0)
@@ -2412,8 +2413,7 @@ swfdec_action_do_enumerate (SwfdecAsContext *cx, SwfdecAsObject *object)
     object = swfdec_as_object_get_prototype (object);
   }
   if (i == 256) {
-    swfdec_as_context_abort (swfdec_gc_object_get_context (object),
-	"Prototype recursion limit exceeded");
+    swfdec_as_context_abort (cx, "Prototype recursion limit exceeded");
     g_slist_free (list);
     return;
   }
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 3c6cdc6..210e03a 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -124,19 +124,18 @@ struct _SwfdecAsVariable {
 };
 
 typedef struct {
+  SwfdecAsContext *	context;	/* context this watch operates in */
   SwfdecAsFunction *	watch;		/* watcher or %NULL */
   SwfdecAsValue		watch_data;	/* user data to watcher */
   guint			refcount;	/* refcount - misused for recursion detection */
 } SwfdecAsWatch;
 
-G_DEFINE_TYPE (SwfdecAsObject, swfdec_as_object, SWFDEC_TYPE_GC_OBJECT)
-
 static gboolean
 swfdec_as_watch_can_recurse (SwfdecAsWatch *watch)
 {
   guint version;
 
-  version = swfdec_gc_object_get_context (watch->watch)->version;
+  version = watch->context->version;
   if (version <= 6) {
     return watch->refcount <= 1;
   } else {
@@ -155,7 +154,7 @@ swfdec_as_watch_unref (SwfdecAsWatch *watch)
 {
   watch->refcount--;
   if (watch->refcount == 0) {
-    swfdec_as_context_unuse_mem (swfdec_gc_object_get_context (watch->watch), 
+    swfdec_as_context_unuse_mem (watch->context, 
 	sizeof (SwfdecAsWatch));
     g_slice_free (SwfdecAsWatch, watch);
   }
@@ -179,40 +178,33 @@ swfdec_as_object_free_property (gpointer key, gpointer value, gpointer data)
 {
   SwfdecAsObject *object = data;
 
-  swfdec_as_context_unuse_mem (swfdec_gc_object_get_context (object), sizeof (SwfdecAsVariable));
+  swfdec_as_context_unuse_mem (object->context, sizeof (SwfdecAsVariable));
   g_slice_free (SwfdecAsVariable, value);
 }
 
-static void
-swfdec_as_object_dispose (GObject *gobject)
+void
+swfdec_as_object_free (SwfdecAsContext *context, SwfdecAsObject *object)
 {
-  SwfdecAsContext *context = swfdec_gc_object_get_context (gobject);
-  SwfdecAsObject *object = SWFDEC_AS_OBJECT (gobject);
-
   if (context->debugger) {
     SwfdecAsDebuggerClass *klass = SWFDEC_AS_DEBUGGER_GET_CLASS (context->debugger);
     if (klass->remove)
       klass->remove (context->debugger, context, object);
   }
 
-  if (object->properties) {
-    g_hash_table_foreach (object->properties, swfdec_as_object_free_property, object);
-    g_hash_table_destroy (object->properties);
-    object->properties = NULL;
-  }
+  g_hash_table_foreach (object->properties, swfdec_as_object_free_property, object);
+  g_hash_table_destroy (object->properties);
+
   if (object->watches) {
     g_hash_table_foreach_steal (object->watches, swfdec_as_object_steal_watches, object);
     g_hash_table_destroy (object->watches);
-    object->watches = NULL;
   }
   g_slist_free (object->interfaces);
-  object->interfaces = NULL;
 
-  G_OBJECT_CLASS (swfdec_as_object_parent_class)->dispose (gobject);
+  swfdec_as_gcable_free (context, object, sizeof (SwfdecAsObject));
 }
 
 static void
-swfdec_gc_object_mark_property (gpointer key, gpointer value, gpointer unused)
+swfdec_as_object_mark_property (gpointer key, gpointer value, gpointer unused)
 {
   SwfdecAsVariable *var = value;
 
@@ -227,7 +219,7 @@ swfdec_gc_object_mark_property (gpointer key, gpointer value, gpointer unused)
 }
 
 static void
-swfdec_gc_object_mark_watch (gpointer key, gpointer value, gpointer unused)
+swfdec_as_object_mark_watch (gpointer key, gpointer value, gpointer unused)
 {
   SwfdecAsWatch *watch = value;
 
@@ -236,19 +228,19 @@ swfdec_gc_object_mark_watch (gpointer key, gpointer value, gpointer unused)
   swfdec_as_value_mark (&watch->watch_data);
 }
 
-static void
-swfdec_as_object_mark (SwfdecGcObject *gc)
+void
+swfdec_as_object_mark (SwfdecAsObject *object)
 {
-  SwfdecAsObject *object = SWFDEC_AS_OBJECT (gc);
+  SWFDEC_AS_GCABLE_SET_FLAG ((SwfdecAsGcable *) object, SWFDEC_AS_GC_MARK);
 
   if (object->prototype)
-    swfdec_gc_object_mark (object->prototype);
-  g_hash_table_foreach (object->properties, swfdec_gc_object_mark_property, NULL);
+    swfdec_as_object_mark (object->prototype);
+  g_hash_table_foreach (object->properties, swfdec_as_object_mark_property, NULL);
   if (object->watches)
-    g_hash_table_foreach (object->watches, swfdec_gc_object_mark_watch, NULL);
+    g_hash_table_foreach (object->watches, swfdec_as_object_mark_watch, NULL);
   if (object->relay)
     swfdec_gc_object_mark (object->relay);
-  g_slist_foreach (object->interfaces, (GFunc) swfdec_gc_object_mark, NULL); 
+  g_slist_foreach (object->interfaces, (GFunc) swfdec_as_object_mark, NULL); 
 }
 
 static gboolean
@@ -268,7 +260,7 @@ swfdec_as_object_hash_lookup (SwfdecAsObject *object, const char *variable)
 {
   SwfdecAsVariable *var = g_hash_table_lookup (object->properties, variable);
 
-  if (var || swfdec_gc_object_get_context (object)->version >= 7)
+  if (var || object->context->version >= 7)
     return var;
   var = g_hash_table_find (object->properties, swfdec_as_object_lookup_case_insensitive, (gpointer) variable);
   return var;
@@ -281,7 +273,7 @@ swfdec_as_object_hash_create (SwfdecAsObject *object, const char *variable, guin
 
   if (!swfdec_as_variable_name_is_valid (variable))
     return NULL;
-  swfdec_as_context_use_mem (swfdec_gc_object_get_context (object), sizeof (SwfdecAsVariable));
+  swfdec_as_context_use_mem (object->context, sizeof (SwfdecAsVariable));
   var = g_slice_new0 (SwfdecAsVariable);
   var->flags = flags;
   g_hash_table_insert (object->properties, (gpointer) variable, var);
@@ -311,11 +303,13 @@ static SwfdecAsWatch *
 swfdec_as_watch_new (SwfdecAsFunction *function)
 {
   SwfdecAsWatch *watch;
+  SwfdecAsContext *cx;
 
-  swfdec_as_context_use_mem (swfdec_gc_object_get_context (function), 
-      sizeof (SwfdecAsWatch));
+  cx = swfdec_gc_object_get_context (function);
+  swfdec_as_context_use_mem (cx, sizeof (SwfdecAsWatch));
 
   watch = g_slice_new (SwfdecAsWatch);
+  watch->context = cx;
   watch->refcount = 1;
   watch->watch = function;
   SWFDEC_AS_VALUE_SET_UNDEFINED (&watch->watch_data);
@@ -334,7 +328,7 @@ swfdec_as_object_get_prototype_internal (SwfdecAsObject *object)
 
   g_return_val_if_fail (object != NULL, NULL);
 
-  version = swfdec_gc_object_get_context (object)->version;
+  version = object->context->version;
 
   if (object->prototype == NULL)
     return NULL;
@@ -367,7 +361,7 @@ swfdec_as_object_get_prototype (SwfdecAsObject *object)
 
   g_return_val_if_fail (object != NULL, NULL);
 
-  version = swfdec_gc_object_get_context (object)->version;
+  version = object->context->version;
 
   prototype = swfdec_as_object_get_prototype_internal (object);
 
@@ -417,7 +411,7 @@ swfdec_as_object_hash_lookup_with_prototype (SwfdecAsObject *object,
     }
 
     if (i == SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT) {
-      swfdec_as_context_abort (swfdec_gc_object_get_context (object), "Prototype recursion limit exceeded");
+      swfdec_as_context_abort (object->context, "Prototype recursion limit exceeded");
       return NULL;
     }
   }
@@ -539,44 +533,6 @@ swfdec_as_object_foreach_rename (SwfdecAsObject *object, SwfdecAsVariableForeach
   object->properties = fdata.properties_new;
 }
 
-static GObject *
-swfdec_as_object_constructor (GType type, guint n_construct_properties,
-    GObjectConstructParam *construct_properties)
-{
-  GObject *gobject;
-  SwfdecAsContext *context;
-
-  gobject = G_OBJECT_CLASS (swfdec_as_object_parent_class)->constructor (type, 
-      n_construct_properties, construct_properties);
-
-  context = swfdec_gc_object_get_context (gobject);
-  if (context->debugger) {
-    SwfdecAsDebuggerClass *dklass = SWFDEC_AS_DEBUGGER_GET_CLASS (context->debugger);
-    if (dklass->add)
-      dklass->add (context->debugger, context, SWFDEC_AS_OBJECT (gobject));
-  }
-
-  return gobject;
-}
-
-static void
-swfdec_as_object_class_init (SwfdecAsObjectClass *klass)
-{
-  GObjectClass *object_class = G_OBJECT_CLASS (klass);
-  SwfdecGcObjectClass *gc_class = SWFDEC_GC_OBJECT_CLASS (klass);
-
-  object_class->constructor = swfdec_as_object_constructor;
-  object_class->dispose = swfdec_as_object_dispose;
-
-  gc_class->mark = swfdec_as_object_mark;
-}
-
-static void
-swfdec_as_object_init (SwfdecAsObject *object)
-{
-  object->properties = g_hash_table_new (g_direct_hash, g_direct_equal);
-}
-
 /**
  * swfdec_as_object_new_empty:
  * @context: a #SwfdecAsContext
@@ -618,14 +574,23 @@ swfdec_as_object_new (SwfdecAsContext *context, ...)
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
   
-  object = g_object_new (SWFDEC_TYPE_AS_OBJECT, "context", context, NULL);
+  object = swfdec_as_gcable_new (context, SwfdecAsObject);
+  object->context = context;
+  object->properties = g_hash_table_new (g_direct_hash, g_direct_equal);
+  SWFDEC_AS_GCABLE_SET_NEXT ((SwfdecAsGcable *) object, context->objects);
+  context->objects = object;
+  if (context->debugger) {
+    SwfdecAsDebuggerClass *dklass = SWFDEC_AS_DEBUGGER_GET_CLASS (context->debugger);
+    if (dklass->add)
+      dklass->add (context->debugger, context, object);
+  }
+
   va_start (args, context);
   name = va_arg (args, const char *);
   if (name == NULL)
     return object;
 
   g_return_val_if_fail (context->global, NULL);
-
   fun = swfdec_as_object_set_constructor_by_namev (object, name, args);
   va_end (args);
   if (SWFDEC_IS_AS_FUNCTION (fun->relay)) {
@@ -670,7 +635,7 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
   g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
 
-  context = swfdec_gc_object_get_context (object);
+  context = object->context;
 
   /* FIXME: in front of or after debugger check? */
   if (!swfdec_as_variable_name_is_valid (variable) ||
@@ -678,11 +643,11 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
       object->super)
     return;
 
-  if (swfdec_gc_object_get_context (object)->debugger) {
-    SwfdecAsDebugger *debugger = swfdec_gc_object_get_context (object)->debugger;
+  if (context->debugger) {
+    SwfdecAsDebugger *debugger = context->debugger;
     SwfdecAsDebuggerClass *dklass = SWFDEC_AS_DEBUGGER_GET_CLASS (debugger);
     if (dklass->set_variable)
-      dklass->set_variable (debugger, swfdec_gc_object_get_context (object), object, variable, value);
+      dklass->set_variable (debugger, context, object, variable, value);
   }
 
   if (object->movie) {
@@ -805,7 +770,7 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
       length = swfdec_as_value_to_integer (context, &tmp);
       if (l >= length) {
 	object->array = FALSE;
-	swfdec_as_value_set_integer (swfdec_gc_object_get_context (object), &tmp, l + 1);
+	swfdec_as_value_set_integer (context, &tmp, l + 1);
 	swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_length, &tmp,
 	    SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
 	object->array = TRUE;
@@ -883,7 +848,7 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
   g_return_val_if_fail (object != NULL, FALSE);
   g_return_val_if_fail (variable != NULL, FALSE);
 
-  context = swfdec_gc_object_get_context (object);
+  context = object->context;
   if (value == NULL)
     value = &tmp_val;
   if (flags == NULL)
@@ -1200,7 +1165,7 @@ swfdec_as_object_add_function (SwfdecAsObject *object, const char *name, SwfdecA
   g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
-  cx = swfdec_gc_object_get_context (object);
+  cx = object->context;
   if (!native)
     native = swfdec_as_object_do_nothing;
   function = swfdec_as_native_function_new (cx, name, native);
@@ -1230,7 +1195,7 @@ swfdec_as_object_run (SwfdecAsObject *object, SwfdecScript *script)
   g_return_if_fail (object != NULL);
   g_return_if_fail (script != NULL);
 
-  context = swfdec_gc_object_get_context (object);
+  context = object->context;
   swfdec_as_frame_init (&frame, context, script);
   if (object->movie) {
     frame.target = SWFDEC_MOVIE (object->relay);
@@ -1275,7 +1240,7 @@ swfdec_as_object_call (SwfdecAsObject *object, const char *name, guint argc,
   g_return_val_if_fail (object != NULL, TRUE);
   g_return_val_if_fail (name != NULL, TRUE);
   g_return_val_if_fail (argc == 0 || argv != NULL, TRUE);
-  g_return_val_if_fail (swfdec_gc_object_get_context (object)->global != NULL, TRUE); /* for SwfdecPlayer */
+  g_return_val_if_fail (object->context->global != NULL, TRUE); /* for SwfdecPlayer */
 
   if (return_value)
     SWFDEC_AS_VALUE_SET_UNDEFINED (return_value);
@@ -1313,7 +1278,7 @@ swfdec_as_object_create (SwfdecAsFunction *fun, guint n_args,
   context = swfdec_gc_object_get_context (fun);
   fun_object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (fun));
 
-  new = g_object_new (SWFDEC_TYPE_AS_OBJECT, "context", context, NULL);
+  new = swfdec_as_object_new (context, NULL);
   /* set initial variables */
   if (swfdec_as_object_get_variable (fun_object, SWFDEC_AS_STR_prototype, &val)) {
       swfdec_as_object_set_variable_and_flags (new, SWFDEC_AS_STR___proto__,
@@ -1356,7 +1321,7 @@ swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object,
   g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
-  context = swfdec_gc_object_get_context (object);
+  context = object->context;
   cur = context->global;
   do {
     val = swfdec_as_object_peek_variable (cur, name);
@@ -1449,11 +1414,11 @@ swfdec_as_object_add_native_variable (SwfdecAsObject *object,
   g_return_if_fail (get != NULL);
 
   get_func =
-    swfdec_as_native_function_new (swfdec_gc_object_get_context (object), variable, get);
+    swfdec_as_native_function_new (object->context, variable, get);
 
   if (set != NULL) {
     set_func =
-      swfdec_as_native_function_new (swfdec_gc_object_get_context (object), variable, set);
+      swfdec_as_native_function_new (object->context, variable, set);
   } else {
     set_func = NULL;
   }
@@ -1509,7 +1474,7 @@ swfdec_as_object_hasOwnProperty (SwfdecAsContext *cx, SwfdecAsObject *object,
   if (argc < 1)
     return;
 
-  name = swfdec_as_value_to_string (swfdec_gc_object_get_context (object), &argv[0]);
+  name = swfdec_as_value_to_string (cx, &argv[0]);
 
   if (!(var = swfdec_as_object_hash_lookup (object, name)))
     return;
@@ -1539,7 +1504,7 @@ swfdec_as_object_isPropertyEnumerable (SwfdecAsContext *cx,
   if (argc < 1)
     return;
 
-  name = swfdec_as_value_to_string (swfdec_gc_object_get_context (object), &argv[0]);
+  name = swfdec_as_value_to_string (cx, &argv[0]);
 
   if (!(var = swfdec_as_object_hash_lookup (object, name)))
     return;
@@ -1691,7 +1656,7 @@ swfdec_as_object_old_constructor (SwfdecAsContext *cx, SwfdecAsObject *object,
 void
 swfdec_as_object_decode (SwfdecAsObject *object, const char *str)
 {
-  SwfdecAsContext *cx = swfdec_gc_object_get_context (object);
+  SwfdecAsContext *cx = object->context;
   SwfdecAsValue val;
   char **varlist, *p, *unescaped;
   guint i;
diff --git a/swfdec/swfdec_as_object.h b/swfdec/swfdec_as_object.h
index b388d9e..43c50a5 100644
--- a/swfdec/swfdec_as_object.h
+++ b/swfdec/swfdec_as_object.h
@@ -22,7 +22,6 @@
 
 #include <glib-object.h>
 #include <swfdec/swfdec_as_types.h>
-#include <swfdec/swfdec_gc_object.h>
 
 G_BEGIN_DECLS
 
@@ -49,17 +48,10 @@ typedef struct _SwfdecAsObjectClass SwfdecAsObjectClass;
 typedef gboolean (* SwfdecAsVariableForeach) (SwfdecAsObject *object, 
     const char *variable, SwfdecAsValue *value, guint flags, gpointer data);
 
-#define SWFDEC_TYPE_AS_OBJECT                    (swfdec_as_object_get_type())
-#define SWFDEC_IS_AS_OBJECT(obj)                 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_AS_OBJECT))
-#define SWFDEC_IS_AS_OBJECT_CLASS(klass)         (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_AS_OBJECT))
-#define SWFDEC_AS_OBJECT(obj)                    (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_AS_OBJECT, SwfdecAsObject))
-#define SWFDEC_AS_OBJECT_CLASS(klass)            (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_AS_OBJECT, SwfdecAsObjectClass))
-#define SWFDEC_AS_OBJECT_GET_CLASS(obj)          (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_AS_OBJECT, SwfdecAsObjectClass))
-
 struct _SwfdecAsObject {
-  /*< protected >*/
-  SwfdecGcObject      	object;
   /*< private >*/
+  SwfdecAsGcable *	next;		/* GC management */
+  SwfdecAsContext *	context;	/* the context that manages the object */
   gboolean		array:1;	/* TRUE if object is an array */
   gboolean		super:1;	/* TRUE if object is a super object */
   gboolean		movie:1;	/* TRUE if object is really a MovieClip */
@@ -71,11 +63,6 @@ struct _SwfdecAsObject {
   SwfdecAsRelay	*	relay;		/* object we relay data to */
 };
 
-struct _SwfdecAsObjectClass {
-  SwfdecGcObjectClass	object_class;
-};
-
-GType		swfdec_as_object_get_type	(void);
 
 SwfdecAsObject *swfdec_as_object_new		(SwfdecAsContext *    	context,
 						 ...) G_GNUC_NULL_TERMINATED;
@@ -95,6 +82,7 @@ void		swfdec_as_object_create		(SwfdecAsFunction *	fun,
 void		swfdec_as_object_set_constructor(SwfdecAsObject *	object,
 						 SwfdecAsObject *	construct);
 SwfdecAsObject *swfdec_as_object_resolve	(SwfdecAsObject *	object);
+void		swfdec_as_object_mark		(SwfdecAsObject *	object);
 
 void		swfdec_as_object_set_relay	(SwfdecAsObject *	object,
 						 SwfdecAsRelay *	relay);
diff --git a/swfdec/swfdec_as_relay.c b/swfdec/swfdec_as_relay.c
index 2123aa1..782a5c1 100644
--- a/swfdec/swfdec_as_relay.c
+++ b/swfdec/swfdec_as_relay.c
@@ -36,7 +36,7 @@ swfdec_as_relay_mark (SwfdecGcObject *object)
   SwfdecAsRelay *relay = SWFDEC_AS_RELAY (object);
 
   if (relay->relay)
-    swfdec_gc_object_mark (relay->relay);
+    swfdec_as_object_mark (relay->relay);
 
   SWFDEC_GC_OBJECT_CLASS (swfdec_as_relay_parent_class)->mark (object);
 }
diff --git a/swfdec/swfdec_as_script_function.c b/swfdec/swfdec_as_script_function.c
index dfd8c13..ce1ac87 100644
--- a/swfdec/swfdec_as_script_function.c
+++ b/swfdec/swfdec_as_script_function.c
@@ -109,7 +109,7 @@ swfdec_as_script_function_mark (SwfdecGcObject *object)
 {
   SwfdecAsScriptFunction *script = SWFDEC_AS_SCRIPT_FUNCTION (object);
 
-  g_slist_foreach (script->scope_chain, (GFunc) swfdec_gc_object_mark, NULL);
+  g_slist_foreach (script->scope_chain, (GFunc) swfdec_as_object_mark, NULL);
   if (script->sandbox)
     swfdec_gc_object_mark (script->sandbox);
 
diff --git a/swfdec/swfdec_as_super.c b/swfdec/swfdec_as_super.c
index e258a06..52cbac8 100644
--- a/swfdec/swfdec_as_super.c
+++ b/swfdec/swfdec_as_super.c
@@ -86,7 +86,7 @@ swfdec_as_super_new (SwfdecAsFrame *frame, SwfdecAsObject *thisp, SwfdecAsObject
   
   if (frame->super != NULL)
     return;
-  context = swfdec_gc_object_get_context (thisp);
+  context = thisp->context;
   if (context->version <= 5)
     return;
 
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index 01d7629..b2e14a6 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -103,14 +103,14 @@ struct _SwfdecAsDoubleValue {
 #define SWFDEC_AS_VALUE_SET_NULL(val) (val)->type = SWFDEC_AS_TYPE_NULL
 
 #define SWFDEC_AS_VALUE_IS_OBJECT(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_OBJECT)
-#define SWFDEC_AS_VALUE_GET_OBJECT(val) ((val)->value.object)
+#define SWFDEC_AS_VALUE_GET_OBJECT(val) ((SwfdecAsObject *) (val)->value.gcable)
 #define SWFDEC_AS_VALUE_SET_OBJECT(val,o) G_STMT_START { \
   SwfdecAsValue *__val = (val); \
   SwfdecAsObject *__o = (o); \
   g_assert (__o != NULL); \
   g_assert (!__o->movie); \
   (__val)->type = SWFDEC_AS_TYPE_OBJECT; \
-  (__val)->value.object = __o; \
+  (__val)->value.gcable = (SwfdecAsGcable *) __o; \
 } G_STMT_END
 
 /* value setters */
diff --git a/swfdec/swfdec_bitmap_data.c b/swfdec/swfdec_bitmap_data.c
index f520e98..96a08a0 100644
--- a/swfdec/swfdec_bitmap_data.c
+++ b/swfdec/swfdec_bitmap_data.c
@@ -352,7 +352,7 @@ static gboolean
 swfdec_rectangle_from_as_object (SwfdecRectangle *rect, SwfdecAsObject *object)
 {
   SwfdecAsValue *val;
-  SwfdecAsContext *cx = swfdec_gc_object_get_context (object);
+  SwfdecAsContext *cx = object->context;
 
   /* FIXME: This function is untested */
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_x);
@@ -370,7 +370,7 @@ static void
 swfdec_point_from_as_object (int *x, int *y, SwfdecAsObject *object)
 {
   SwfdecAsValue *val;
-  SwfdecAsContext *cx = swfdec_gc_object_get_context (object);
+  SwfdecAsContext *cx = object->context;
 
   /* FIXME: This function is untested */
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_x);
diff --git a/swfdec/swfdec_color_as.c b/swfdec/swfdec_color_as.c
index a897071..a610950 100644
--- a/swfdec/swfdec_color_as.c
+++ b/swfdec/swfdec_color_as.c
@@ -70,7 +70,7 @@ add_variable (SwfdecAsObject *obj, const char *name, double value)
 {
   SwfdecAsValue val;
 
-  swfdec_as_value_set_number (swfdec_gc_object_get_context (obj), &val, value);
+  swfdec_as_value_set_number (obj->context, &val, value);
   swfdec_as_object_set_variable (obj, name, &val);
 }
 
@@ -135,7 +135,7 @@ parse_property (SwfdecAsObject *obj, const char *name, int *target, gboolean sca
 
   if (!swfdec_as_object_get_variable (obj, name, &val))
     return;
-  d = swfdec_as_value_to_number (swfdec_gc_object_get_context (obj), &val);
+  d = swfdec_as_value_to_number (obj->context, &val);
   if (scale) {
     *target = d * 256.0 / 100.0;
   } else {
diff --git a/swfdec/swfdec_load_object_as.c b/swfdec/swfdec_load_object_as.c
index a2431be..2c55cac 100644
--- a/swfdec/swfdec_load_object_as.c
+++ b/swfdec/swfdec_load_object_as.c
@@ -125,7 +125,7 @@ swfdec_load_object_as_get_headers (SwfdecAsObject *object, guint *header_count,
   const char *name;
   SwfdecAsContext *cx;
 
-  cx = swfdec_gc_object_get_context (object);
+  cx = object->context;
 
   array_names = g_ptr_array_new ();
   array_values = g_ptr_array_new ();
diff --git a/swfdec/swfdec_load_sound.c b/swfdec/swfdec_load_sound.c
index abccb35..7fa60b4 100644
--- a/swfdec/swfdec_load_sound.c
+++ b/swfdec/swfdec_load_sound.c
@@ -91,7 +91,7 @@ swfdec_load_sound_sound_provider_init (SwfdecSoundProviderInterface *iface)
 static SwfdecPlayer *
 swfdec_load_sound_stream_target_get_player (SwfdecStreamTarget *target)
 {
-  return SWFDEC_PLAYER (swfdec_gc_object_get_context (SWFDEC_LOAD_SOUND (target)->target));
+  return SWFDEC_PLAYER (SWFDEC_LOAD_SOUND (target)->target->context);
 }
 
 static gboolean
@@ -407,7 +407,7 @@ swfdec_load_sound_new (SwfdecAsObject *target, const char *url)
   g_return_val_if_fail (target != NULL, NULL);
   g_return_val_if_fail (url != NULL, NULL);
 
-  context = swfdec_gc_object_get_context (target);
+  context = target->context;
   sound = g_object_new (SWFDEC_TYPE_LOAD_SOUND, NULL);
   sound->target = target;
   sound->sandbox = swfdec_sandbox_get (SWFDEC_PLAYER (context));
diff --git a/swfdec/swfdec_movie.c b/swfdec/swfdec_movie.c
index 206fd23..800526f 100644
--- a/swfdec/swfdec_movie.c
+++ b/swfdec/swfdec_movie.c
@@ -1296,7 +1296,7 @@ swfdec_movie_constructor (GType type, guint n_construct_properties,
       n_construct_properties, construct_properties);
   movie = SWFDEC_MOVIE (object);
 
-  cx = swfdec_gc_object_get_context (object);
+  cx = swfdec_gc_object_get_context (movie);
   priv = SWFDEC_PLAYER (cx)->priv;
   /* the movie is created invalid */
   priv->invalid_pending = g_slist_prepend (priv->invalid_pending, object);
diff --git a/swfdec/swfdec_movie_as_drawing.c b/swfdec/swfdec_movie_as_drawing.c
index 491b5a5..a1b69b1 100644
--- a/swfdec/swfdec_movie_as_drawing.c
+++ b/swfdec/swfdec_movie_as_drawing.c
@@ -106,7 +106,7 @@ swfdec_sprite_movie_gradient_fill_get_length (SwfdecAsObject *o)
   SwfdecAsValue val;
 
   swfdec_as_object_get_variable (o, SWFDEC_AS_STR_length, &val);
-  length = swfdec_as_value_to_integer (swfdec_gc_object_get_context (o), &val);
+  length = swfdec_as_value_to_integer (o->context, &val);
   return MAX (length, 0);
 }
 
@@ -126,7 +126,7 @@ swfdec_sprite_movie_gradient_fill_check_length (SwfdecAsObject *colors, SwfdecAs
 static void
 swfdec_sprite_movie_extract_matrix (SwfdecAsObject *o, cairo_matrix_t *mat)
 {
-  SwfdecAsContext *cx = swfdec_gc_object_get_context (o);
+  SwfdecAsContext *cx = o->context;
   SwfdecAsValue val;
 
   /* FIXME: This function does not call valueOf in the right order */
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index a6b05cf..9d5fbe5 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -2064,7 +2064,14 @@ swfdec_accumulate_quit (GSignalInvocationHint *ihint, GValue *return_accu,
 }
 
 static void
-swfdec_player_mark_string_object (gpointer key, gpointer value, gpointer data)
+swfdec_player_mark_string_as_object (gpointer key, gpointer value, gpointer data)
+{
+  swfdec_as_string_mark (key);
+  swfdec_as_object_mark (value);
+}
+
+static void
+swfdec_player_mark_string_gc_object (gpointer key, gpointer value, gpointer data)
 {
   swfdec_as_string_mark (key);
   swfdec_gc_object_mark (value);
@@ -2076,8 +2083,8 @@ swfdec_player_mark (SwfdecAsContext *context)
   SwfdecPlayer *player = SWFDEC_PLAYER (context);
   SwfdecPlayerPrivate *priv = player->priv;
 
-  g_hash_table_foreach (priv->registered_classes, swfdec_player_mark_string_object, NULL);
-  g_hash_table_foreach (priv->scripting_callbacks, swfdec_player_mark_string_object, NULL);
+  g_hash_table_foreach (priv->registered_classes, swfdec_player_mark_string_as_object, NULL);
+  g_hash_table_foreach (priv->scripting_callbacks, swfdec_player_mark_string_gc_object, NULL);
   g_list_foreach (priv->roots, (GFunc) swfdec_gc_object_mark, NULL);
   g_list_foreach (priv->intervals, (GFunc) swfdec_gc_object_mark, NULL);
   g_slist_foreach (priv->sandboxes, (GFunc) swfdec_gc_object_mark, NULL);
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 12d5626..3cda6d0 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -819,7 +819,7 @@ swfdec_sprite_movie_attachMovie (SwfdecAsContext *cx, SwfdecAsObject *object,
   ret = swfdec_movie_find (movie, depth);
   if (ret)
     swfdec_movie_remove (ret);
-  ret = swfdec_movie_new (SWFDEC_PLAYER (swfdec_gc_object_get_context (object)),
+  ret = swfdec_movie_new (SWFDEC_PLAYER (cx),
       depth, movie, movie->resource, sprite, name);
   SWFDEC_LOG ("attached %s (%u) as %s to depth %u", export, SWFDEC_CHARACTER (sprite)->id,
       ret->name, ret->depth);
diff --git a/swfdec/swfdec_style_sheet.c b/swfdec/swfdec_style_sheet.c
index 8faf046..4df1967 100644
--- a/swfdec/swfdec_style_sheet.c
+++ b/swfdec/swfdec_style_sheet.c
@@ -68,7 +68,7 @@ swfdec_style_sheet_get_selector_object (SwfdecAsObject *object,
   g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
-  empty = swfdec_as_object_new_empty (swfdec_gc_object_get_context (object));
+  empty = swfdec_as_object_new_empty (object->context);
   SWFDEC_AS_VALUE_SET_OBJECT (&val, empty);
   swfdec_as_object_unset_variable_flags (object, name,
       SWFDEC_AS_VARIABLE_CONSTANT);
diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index eabce5d..83eb6ce 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -321,7 +321,7 @@ swfdec_text_field_movie_mark (SwfdecGcObject *object)
 
   swfdec_text_buffer_mark (text->text);
   if (text->style_sheet != NULL)
-    swfdec_gc_object_mark (text->style_sheet);
+    swfdec_as_object_mark (text->style_sheet);
   if (text->style_sheet_input != NULL)
     swfdec_as_string_mark (text->style_sheet_input);
   if (text->restrict_ != NULL)
diff --git a/swfdec/swfdec_text_field_movie_html.c b/swfdec/swfdec_text_field_movie_html.c
index 81e68e2..aa70fd0 100644
--- a/swfdec/swfdec_text_field_movie_html.c
+++ b/swfdec/swfdec_text_field_movie_html.c
@@ -129,7 +129,7 @@ swfdec_text_field_movie_html_tag_set_attribute (ParserData *data,
     return;
 
   object = swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (tag->format));
-  cx = swfdec_gc_object_get_context (object);
+  cx = swfdec_gc_object_get_context (tag->format);
   SWFDEC_AS_VALUE_SET_STRING (&val, swfdec_as_context_give_string (
 	cx, g_strndup (value, value_length)));
 
diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 39e05e7..4a0e63e 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -217,7 +217,7 @@ swfdec_text_format_get_integer (SwfdecAsObject *object,
     return;
   }
 
-  swfdec_as_value_set_number (swfdec_gc_object_get_context (object), ret,
+  swfdec_as_value_set_number (object->context, ret,
       (double)G_STRUCT_MEMBER (int, format, property_offsets[property]));
 }
 
diff --git a/swfdec/swfdec_utils.c b/swfdec/swfdec_utils.c
index 4108bf4..448c7c9 100644
--- a/swfdec/swfdec_utils.c
+++ b/swfdec/swfdec_utils.c
@@ -81,7 +81,7 @@ gboolean
 swfdec_matrix_from_as_object (cairo_matrix_t *matrix, SwfdecAsObject *object)
 {
   SwfdecAsValue *val;
-  SwfdecAsContext *cx = swfdec_gc_object_get_context (object);
+  SwfdecAsContext *cx = object->context;
 
   val = swfdec_as_object_peek_variable (object, SWFDEC_AS_STR_a);
   if (val == NULL ||
diff --git a/swfdec/swfdec_xml_node.c b/swfdec/swfdec_xml_node.c
index 23ecee6..db3ea9b 100644
--- a/swfdec/swfdec_xml_node.c
+++ b/swfdec/swfdec_xml_node.c
@@ -50,11 +50,11 @@ swfdec_xml_node_mark (SwfdecGcObject *object)
   if (node->parent != NULL)
     swfdec_gc_object_mark (node->parent);
   if (node->children != NULL)
-    swfdec_gc_object_mark (node->children);
+    swfdec_as_object_mark (node->children);
   if (node->attributes != NULL)
-    swfdec_gc_object_mark (node->attributes);
+    swfdec_as_object_mark (node->attributes);
   if (node->child_nodes != NULL)
-    swfdec_gc_object_mark (node->child_nodes);
+    swfdec_as_object_mark (node->child_nodes);
 
   SWFDEC_GC_OBJECT_CLASS (swfdec_xml_node_parent_class)->mark (object);
 }
@@ -210,7 +210,7 @@ swfdec_xml_node_foreach_find_namespace (SwfdecAsObject *object,
     return TRUE;
 
   // ok, now check if the uri is the one we are searching for
-  uri = swfdec_as_value_to_string (swfdec_gc_object_get_context (object), value);
+  uri = swfdec_as_value_to_string (object->context, value);
   if (!g_ascii_strcasecmp (uri, fdata->namespace)) {
     fdata->variable = variable;
     return FALSE;
@@ -892,7 +892,7 @@ swfdec_xml_node_foreach_string_append_attribute (SwfdecAsObject *object,
   string = g_string_append (string, variable);
   string = g_string_append (string, "=\"");
   escaped =
-    swfdec_xml_escape (swfdec_as_value_to_string (swfdec_gc_object_get_context (object), value));
+    swfdec_xml_escape (swfdec_as_value_to_string (object->context, value));
   string = g_string_append (string, escaped);
   g_free (escaped);
   string = g_string_append (string, "\"");
diff --git a/swfdec/swfdec_xml_socket.c b/swfdec/swfdec_xml_socket.c
index 06cb7a2..a55ac96 100644
--- a/swfdec/swfdec_xml_socket.c
+++ b/swfdec/swfdec_xml_socket.c
@@ -165,7 +165,7 @@ swfdec_xml_socket_mark (SwfdecGcObject *object)
 {
   SwfdecXmlSocket *sock = SWFDEC_XML_SOCKET (object);
 
-  swfdec_gc_object_mark (sock->target);
+  swfdec_as_object_mark (sock->target);
   swfdec_gc_object_mark (sock->sandbox);
 
   SWFDEC_GC_OBJECT_CLASS (swfdec_xml_socket_parent_class)->mark (object);
@@ -205,7 +205,7 @@ swfdec_xml_socket_init (SwfdecXmlSocket *xml)
 static SwfdecXmlSocket *
 swfdec_xml_socket_create (SwfdecAsObject *target, SwfdecSandbox *sandbox, const char *hostname, guint port)
 {
-  SwfdecPlayer *player = SWFDEC_PLAYER (swfdec_gc_object_get_context (target));
+  SwfdecPlayer *player = SWFDEC_PLAYER (target->context);
   SwfdecXmlSocket *xml;
   SwfdecSocket *sock;
 
@@ -240,7 +240,7 @@ swfdec_xml_socket_get (SwfdecAsObject *object)
     return NULL;
   }
 
-  player = SWFDEC_PLAYER (swfdec_gc_object_get_context (object));
+  player = SWFDEC_PLAYER (object->context);
   for (walk = player->priv->xml_sockets; walk; walk = walk->next) {
     xml = walk->data;
 
diff --git a/test/various/Makefile.am b/test/various/Makefile.am
index 072c490..9493143 100644
--- a/test/various/Makefile.am
+++ b/test/various/Makefile.am
@@ -1,10 +1,6 @@
-check_PROGRAMS = gc ringbuffer
+check_PROGRAMS = ringbuffer
 TESTS = $(check_PROGRAMS)
 
-gc_SOURCES = gc.c
-gc_CFLAGS = $(GLOBAL_CFLAGS) $(SWFDEC_CFLAGS) $(CAIRO_CFLAGS)
-gc_LDFLAGS = $(SWFDEC_LIBS) $(CAIRO_LIBS)
-
 ringbuffer_SOURCES = ringbuffer.c
 ringbuffer_CFLAGS = $(GLOBAL_CFLAGS) $(SWFDEC_CFLAGS) $(CAIRO_CFLAGS)
 ringbuffer_LDFLAGS = $(SWFDEC_LIBS) $(CAIRO_LIBS)
diff --git a/test/various/gc.c b/test/various/gc.c
deleted file mode 100644
index 2d4298c..0000000
--- a/test/various/gc.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Swfdec
- * Copyright (C) 2006 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
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- * 
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- * 
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, 
- * Boston, MA  02110-1301  USA
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "swfdec/swfdec_as_context.h"
-#include "swfdec/swfdec_as_object.h"
-#include "swfdec/swfdec_as_strings.h"
-
-#define ERROR(...) G_STMT_START { \
-  g_printerr ("ERROR (line %u): ", __LINE__); \
-  g_printerr (__VA_ARGS__); \
-  g_printerr ("\n"); \
-  errors++; \
-}G_STMT_END
-
-static guint
-check_strings (void)
-{
-  const char *s;
-  guint errors = 0;
-  SwfdecAsContext *context;
-  
-  context = g_object_new (SWFDEC_TYPE_AS_CONTEXT, NULL);
-  swfdec_as_context_startup (context);
-
-  s = swfdec_as_context_get_string (context, "hi mom");
-  if (!g_str_equal (s, "hi mom")) {
-    ERROR ("swfdec_as_context_get_string returns different string from input");
-  }
-
-  g_object_unref (context);
-  return errors;
-}
-
-static guint
-check_objects (void)
-{
-  SwfdecAsObject *object;
-  guint errors = 0;
-  SwfdecAsContext *context;
-  SwfdecAsValue val;
-  gpointer check = GUINT_TO_POINTER (-1); /* NOT NULL */
-  
-  context = g_object_new (SWFDEC_TYPE_AS_CONTEXT, NULL);
-  swfdec_as_context_startup (context);
-  g_assert (check != NULL);
-
-  object = swfdec_as_object_new (context, NULL);
-  g_object_add_weak_pointer (G_OBJECT (object), &check);
-  SWFDEC_AS_VALUE_SET_OBJECT (&val, object);
-  swfdec_as_object_set_variable (context->global, SWFDEC_AS_STR__root, &val);
-  swfdec_as_context_gc (context);
-  if (check == NULL) {
-    ERROR ("GC collected a rooted object, bailing");
-    g_object_unref (context);
-    return errors;
-  }
-  swfdec_as_object_delete_variable (context->global, SWFDEC_AS_STR__root);
-  swfdec_as_context_gc (context);
-  if (check != NULL) {
-    ERROR ("GC did not collect an unreferenced object");
-  }
-
-  g_object_unref (context);
-  return errors;
-}
-
-static guint
-check_object_variables (void)
-{
-  SwfdecAsObject *o, *o2;
-  guint errors = 0;
-  SwfdecAsContext *context;
-  const char *s;
-  gpointer check = GUINT_TO_POINTER (-1); /* NOT NULL */
-  gpointer check2 = GUINT_TO_POINTER (-1); /* NOT NULL */
-  SwfdecAsValue v1, v2;
-  
-  context = g_object_new (SWFDEC_TYPE_AS_CONTEXT, NULL);
-  swfdec_as_context_startup (context);
-  g_assert (check != NULL);
-
-  o = swfdec_as_object_new (context, NULL);
-  o2 = swfdec_as_object_new (context, NULL);
-  g_object_add_weak_pointer (G_OBJECT (o), &check);
-  g_object_add_weak_pointer (G_OBJECT (o2), &check2);
-  s = swfdec_as_context_get_string (context, "foo");
-  /* step one: set a variable */
-  SWFDEC_AS_VALUE_SET_OBJECT (&v1, o);
-  swfdec_as_object_set_variable (context->global, s, &v1);
-  SWFDEC_AS_VALUE_SET_OBJECT (&v2, o2);
-  swfdec_as_object_set_variable (o, s, &v2);
-  SWFDEC_AS_VALUE_SET_UNDEFINED (&v2);
-  swfdec_as_object_get_variable (o, s, &v2);
-  if (!SWFDEC_AS_VALUE_IS_OBJECT (&v2)) {
-    ERROR ("variable changed type");
-  } else if (o2 != SWFDEC_AS_VALUE_GET_OBJECT (&v2)) {
-    ERROR ("variable changed value");
-  }
-  /* step 2: gc */
-  swfdec_as_context_gc (context);
-  if (check == NULL || check2 == NULL) {
-    ERROR ("GC collected a used object, bailing");
-    g_object_unref (context);
-    return errors;
-  }
-  /* step 3: unset root reference and set cyclic variable */
-  swfdec_as_object_delete_variable (context->global, s);
-  swfdec_as_object_set_variable (o2, s, &v1);
-  SWFDEC_AS_VALUE_SET_UNDEFINED (&v1);
-  swfdec_as_object_get_variable (o2, s, &v1);
-  if (!SWFDEC_AS_VALUE_IS_OBJECT (&v1)) {
-    ERROR ("variable changed type");
-  } else if (o != SWFDEC_AS_VALUE_GET_OBJECT (&v1)) {
-    ERROR ("variable changed value");
-  }
-  /* step 4: gc, ensure that both objects disappears */
-  swfdec_as_context_gc (context);
-  if (check != NULL || check2 != NULL) {
-    ERROR ("GC didn't collect unused object");
-  }
-
-  g_object_unref (context);
-  return errors;
-
-}
-
-int
-main (int argc, char **argv)
-{
-  guint errors = 0;
-
-  g_type_init ();
-
-  errors += check_strings ();
-  errors += check_objects ();
-  errors += check_object_variables ();
-
-  g_print ("TOTAL ERRORS: %u\n", errors);
-  return errors;
-}
-
commit 07c628033396540cd74238625cee9ab22cb59e20
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 21:50:42 2008 +0100

    remove SWFDEC_IS_AS_VALUE check
    
    This check will be useless soon, when SwfdecAsValue is passed by-value
    to functions as opposed to by-ref

diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index f9c0b8a..720cf2c 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -352,7 +352,6 @@ swfdec_as_array_insert_with_flags (SwfdecAsObject *array, gint32 idx,
 
   g_return_if_fail (array != NULL);
   g_return_if_fail (idx >= 0);
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
 
   length = swfdec_as_array_get_length (array);
 
@@ -426,7 +425,6 @@ swfdec_as_array_set_value (SwfdecAsObject *array, gint32 idx,
 
   g_assert (array != NULL);
   g_assert (idx >= 0);
-  g_assert (SWFDEC_IS_AS_VALUE (value));
 
   var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (array), idx);
   swfdec_as_object_set_variable (array, var, value);
@@ -855,8 +853,6 @@ swfdec_as_array_sort_compare_values (SwfdecAsContext *cx,
   int retval;
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (cx), 0);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (a), 0);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (b), 0);
   g_return_val_if_fail (custom_function == NULL ||
       SWFDEC_IS_AS_FUNCTION (custom_function), 0);
 
@@ -921,8 +917,6 @@ swfdec_as_array_sort_compare (gconstpointer a_ptr, gconstpointer b_ptr,
   SortCompareData *data = user_data;
   int retval;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (a), 0);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (b), 0);
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (data->context), 0);
   g_return_val_if_fail (data->options != NULL, 0);
   g_return_val_if_fail (data->custom_function == NULL ||
diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 995aa80..30afb28 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -350,7 +350,6 @@ swfdec_as_string_mark (const char *string)
 void
 swfdec_as_value_mark (SwfdecAsValue *value)
 {
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
 
   if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
     swfdec_gc_object_mark (value->value.object);
@@ -708,7 +707,6 @@ void
 swfdec_as_context_throw (SwfdecAsContext *context, const SwfdecAsValue *value)
 {
   g_return_if_fail (SWFDEC_IS_AS_CONTEXT (context));
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
   g_return_if_fail (!context->exception);
 
   context->exception = TRUE;
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index 1e237b4..8a6bbac 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -555,7 +555,6 @@ swfdec_player_get_movie_from_value (SwfdecPlayer *player, SwfdecAsValue *val)
   const char *s;
 
   g_return_val_if_fail (SWFDEC_IS_PLAYER (player), NULL);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (val), NULL);
 
   cx = SWFDEC_AS_CONTEXT (player);
   s = swfdec_as_value_to_string (cx, val);
@@ -2601,7 +2600,6 @@ swfdec_action_try_end_finally (SwfdecAsContext *cx, SwfdecAsFrame *frame, gpoint
 {
   SwfdecAsValue *exception_value = data;
 
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (exception_value));
 
   // finally has ended and we had exception stored, throw it
   if (!cx->exception && cx->frame == frame)
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 106dcc5..3c6cdc6 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -669,7 +669,6 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
 
   g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
 
   context = swfdec_gc_object_get_context (object);
 
diff --git a/swfdec/swfdec_as_types.c b/swfdec/swfdec_as_types.c
index a4c644e..91caa25 100644
--- a/swfdec/swfdec_as_types.c
+++ b/swfdec/swfdec_as_types.c
@@ -386,7 +386,6 @@ const char *
 swfdec_as_value_to_string (SwfdecAsContext *context, const SwfdecAsValue *value)
 {
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), SWFDEC_AS_STR_EMPTY);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), SWFDEC_AS_STR_EMPTY);
 
   switch (SWFDEC_AS_VALUE_GET_TYPE (value)) {
     case SWFDEC_AS_TYPE_STRING:
@@ -455,7 +454,6 @@ swfdec_as_value_to_number (SwfdecAsContext *context, const SwfdecAsValue *value)
   SwfdecAsValue tmp;
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), 0.0);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), 0.0);
 
   tmp = *value;
   swfdec_as_value_to_primitive (&tmp);
@@ -568,7 +566,6 @@ swfdec_as_value_to_object (SwfdecAsContext *context, const SwfdecAsValue *value)
   const char *s;
 
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), NULL);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), NULL);
 
   switch (SWFDEC_AS_VALUE_GET_TYPE (value)) {
     case SWFDEC_AS_TYPE_UNDEFINED:
@@ -619,7 +616,6 @@ gboolean
 swfdec_as_value_to_boolean (SwfdecAsContext *context, const SwfdecAsValue *value)
 {
   g_return_val_if_fail (SWFDEC_IS_AS_CONTEXT (context), FALSE);
-  g_return_val_if_fail (SWFDEC_IS_AS_VALUE (value), FALSE);
 
   /* FIXME: what do we do when called in flash 4? */
   switch (SWFDEC_AS_VALUE_GET_TYPE (value)) {
@@ -662,7 +658,6 @@ swfdec_as_value_to_boolean (SwfdecAsContext *context, const SwfdecAsValue *value
 void
 swfdec_as_value_to_primitive (SwfdecAsValue *value)
 {
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
 
   if (SWFDEC_AS_VALUE_IS_OBJECT (value)) {
     swfdec_as_object_call (SWFDEC_AS_VALUE_GET_OBJECT (value), SWFDEC_AS_STR_valueOf,
diff --git a/swfdec/swfdec_as_types.h b/swfdec/swfdec_as_types.h
index 6b0ddbc..01d7629 100644
--- a/swfdec/swfdec_as_types.h
+++ b/swfdec/swfdec_as_types.h
@@ -68,7 +68,6 @@ struct _SwfdecAsValue {
   } value;
 };
 
-#define SWFDEC_IS_AS_VALUE(val) ((val) != NULL && SWFDEC_AS_VALUE_GET_TYPE (val) <= SWFDEC_TYPE_AS_OBJECT)
 #define SWFDEC_AS_VALUE_GET_TYPE(val) ((val)->type)
 
 #define SWFDEC_AS_VALUE_IS_UNDEFINED(val) (SWFDEC_AS_VALUE_GET_TYPE (val) == SWFDEC_AS_TYPE_UNDEFINED)
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 1ea2dd7..12d5626 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -500,7 +500,6 @@ swfdec_sprite_movie_do_goto (SwfdecSpriteMovie *movie, SwfdecAsValue *target)
 
   g_return_if_fail (SWFDEC_IS_SPRITE_MOVIE (movie));
   g_return_if_fail (movie->sprite != NULL);
-  g_return_if_fail (SWFDEC_IS_AS_VALUE (target));
 
   if (SWFDEC_AS_VALUE_IS_STRING (target)) {
     const char *label = SWFDEC_AS_VALUE_GET_STRING (target);
commit d48bf3b97501d35c5e43b80c448583c341ab5290
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 21:46:38 2008 +0100

    reorder headers

diff --git a/swfdec/swfdec_button.c b/swfdec/swfdec_button.c
index 8957f81..4620156 100644
--- a/swfdec/swfdec_button.c
+++ b/swfdec/swfdec_button.c
@@ -22,8 +22,10 @@
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
-#include <string.h>
 #include "swfdec_button.h"
+
+#include <string.h>
+
 #include "swfdec_button_movie.h"
 #include "swfdec_debug.h"
 #include "swfdec_filter.h"
commit 08fc8b9fa2d073641528d8b52951473dac203a63
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 21:46:33 2008 +0100

    use right parent class

diff --git a/swfdec/swfdec_filter.h b/swfdec/swfdec_filter.h
index e362754..ad644dd 100644
--- a/swfdec/swfdec_filter.h
+++ b/swfdec/swfdec_filter.h
@@ -41,7 +41,7 @@ struct _SwfdecFilter {
 };
 
 struct _SwfdecFilterClass {
-  SwfdecAsObjectClass	relay_class;
+  SwfdecAsRelayClass	relay_class;
 
   void			(* clone)		(SwfdecFilter *		dest,
 						 SwfdecFilter *		source);
commit efd551b23d9113f7f20fadb24263618da0bb2f2d
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 21:46:07 2008 +0100

    use right parent class

diff --git a/swfdec/swfdec_xml_node.h b/swfdec/swfdec_xml_node.h
index ad5b35c..0b1286d 100644
--- a/swfdec/swfdec_xml_node.h
+++ b/swfdec/swfdec_xml_node.h
@@ -77,7 +77,7 @@ struct _SwfdecXmlNode {
 };
 
 struct _SwfdecXmlNodeClass {
-  SwfdecAsObjectClass	object_class;
+  SwfdecAsRelayClass	object_class;
 };
 
 GType		swfdec_xml_node_get_type	(void);
commit d53dbe9967bbdbb7648853b430f1b9430a97d24e
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 21:24:36 2008 +0100

    change how gcobjects are tracked by the context
    
    Previously we just dumped them all in a Hashtable. Now we use next
    pointers, just like Gcables.

diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index b68bb97..995aa80 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -250,22 +250,31 @@ swfdec_as_context_unuse_mem (SwfdecAsContext *context, gsize bytes)
 
 /*** GC ***/
 
-static gboolean
-swfdec_as_context_remove_objects (gpointer key, gpointer value, gpointer debugger)
+static void
+swfdec_as_context_remove_gc_objects (SwfdecAsContext *context)
 {
-  SwfdecGcObject *gc;
-
-  gc = key;
-  /* we only check for mark here, not root, since this works on destroy, too */
-  if (gc->flags & SWFDEC_AS_GC_MARK) {
-    gc->flags &= ~SWFDEC_AS_GC_MARK;
-    SWFDEC_LOG ("%s: %s %p", (gc->flags & SWFDEC_AS_GC_ROOT) ? "rooted" : "marked",
-	G_OBJECT_TYPE_NAME (gc), gc);
-    return FALSE;
-  } else {
-    SWFDEC_LOG ("deleted: %s %p", G_OBJECT_TYPE_NAME (gc), gc);
-    g_object_unref (gc);
-    return TRUE;
+  SwfdecGcObject *gc, *prev, *next;
+
+  prev = NULL;
+  gc = context->gc_objects;
+  while (gc) {
+    next = gc->next;
+    /* we only check for mark here, not root, since this works on destroy, too */
+    if (gc->flags & SWFDEC_AS_GC_MARK) {
+      gc->flags &= ~SWFDEC_AS_GC_MARK;
+      SWFDEC_LOG ("%s: %s %p", (gc->flags & SWFDEC_AS_GC_ROOT) ? "rooted" : "marked",
+	  G_OBJECT_TYPE_NAME (gc), gc);
+      prev = gc;
+    } else {
+      SWFDEC_LOG ("deleted: %s %p", G_OBJECT_TYPE_NAME (gc), gc);
+      g_object_unref (gc);
+      if (prev) {
+	prev->next = next;
+      } else {
+	context->gc_objects = next;
+      }
+    }
+    gc = next;
   }
 }
 
@@ -299,8 +308,7 @@ swfdec_as_context_collect (SwfdecAsContext *context)
   /* NB: This functions is called without GC from swfdec_as_context_dispose */
   SWFDEC_INFO (">> collecting garbage");
   
-  g_hash_table_foreach_remove (context->objects, 
-    swfdec_as_context_remove_objects, context->debugger);
+  swfdec_as_context_remove_gc_objects (context);
 
   context->strings = swfdec_as_gcable_collect (context, context->strings,
       swfdec_as_context_collect_string);
@@ -356,15 +364,6 @@ swfdec_as_value_mark (SwfdecAsValue *value)
   }
 }
 
-static void
-swfdec_as_context_mark_roots (gpointer key, gpointer value, gpointer data)
-{
-  SwfdecGcObject *object = key;
-
-  if ((object->flags & (SWFDEC_AS_GC_MARK | SWFDEC_AS_GC_ROOT)) == SWFDEC_AS_GC_ROOT)
-    swfdec_gc_object_mark (object);
-}
-
 /* FIXME: replace this with refcounted strings? */
 static void 
 swfdec_as_context_mark_constant_pools (gpointer key, gpointer value, gpointer unused)
@@ -387,7 +386,6 @@ swfdec_as_context_do_mark (SwfdecAsContext *context)
     swfdec_gc_object_mark (context->global);
   if (context->exception)
     swfdec_as_value_mark (&context->exception_value);
-  g_hash_table_foreach (context->objects, swfdec_as_context_mark_roots, NULL);
   g_hash_table_foreach (context->constant_pools, swfdec_as_context_mark_constant_pools, NULL);
 }
 
@@ -524,9 +522,8 @@ swfdec_as_context_dispose (GObject *object)
   g_assert (context->strings == NULL);
   g_assert (context->numbers == NULL);
   g_assert (g_hash_table_size (context->constant_pools) == 0);
-  g_assert (g_hash_table_size (context->objects) == 0);
+  g_assert (context->gc_objects == 0);
   g_hash_table_destroy (context->constant_pools);
-  g_hash_table_destroy (context->objects);
   g_hash_table_destroy (context->interned_strings);
   g_rand_free (context->rand);
   if (context->debugger) {
@@ -584,7 +581,6 @@ swfdec_as_context_init (SwfdecAsContext *context)
   context->version = G_MAXUINT;
 
   context->interned_strings = g_hash_table_new (g_str_hash, g_str_equal);
-  context->objects = g_hash_table_new (g_direct_hash, g_direct_equal);
   context->constant_pools = g_hash_table_new (g_direct_hash, g_direct_equal);
 
   for (s = swfdec_as_strings; s->next; s++) {
diff --git a/swfdec/swfdec_as_context.h b/swfdec/swfdec_as_context.h
index 38f6981..99c3dc6 100644
--- a/swfdec/swfdec_as_context.h
+++ b/swfdec/swfdec_as_context.h
@@ -57,7 +57,7 @@ struct _SwfdecAsContext {
   gsize			memory;		/* total memory currently in use */
   gsize			memory_since_gc;/* memory allocated since last GC run */
   GHashTable *		interned_strings;/* string => memory mapping the context manages */
-  GHashTable *		objects;	/* all objects the context manages */
+  gpointer		gc_objects;	/* all SwfdecGcObjects the context manages */
   gpointer		strings;	/* all numbers the context manages */
   gpointer		numbers;	/* all numbers the context manages */
   gpointer		movies;		/* all movies the context manages */
diff --git a/swfdec/swfdec_gc_object.c b/swfdec/swfdec_gc_object.c
index f3016cc..6e6451b 100644
--- a/swfdec/swfdec_gc_object.c
+++ b/swfdec/swfdec_gc_object.c
@@ -108,7 +108,8 @@ swfdec_gc_object_constructor (GType type, guint n_construct_properties,
 
   context = object->context;
   swfdec_as_context_use_mem (context, swfdec_gc_object_get_size (object));
-  g_hash_table_insert (context->objects, object, object);
+  object->next = context->gc_objects;
+  context->gc_objects = object;
 
   return gobject;
 }
diff --git a/swfdec/swfdec_gc_object.h b/swfdec/swfdec_gc_object.h
index 8553165..c18e358 100644
--- a/swfdec/swfdec_gc_object.h
+++ b/swfdec/swfdec_gc_object.h
@@ -39,6 +39,7 @@ struct _SwfdecGcObject {
   GObject		object;
   SwfdecAsContext *	context;	/* context the object belongs to - NB: object holds no reference */
   /*< private >*/
+  SwfdecGcObject *	next;		/* next GcObject in list of context's object */
   guint8		flags;		/* GC flags */
   gsize			size;		/* size reserved in GC */
 };
commit 2c11df6750e6d4ce1d37cf3e248949ee7f7cf55c
Author: Benjamin Otte <otte at gnome.org>
Date:   Wed Nov 5 21:01:30 2008 +0100

    replace SWFDEC_IS_AS_OBJECT checks with != NULL

diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index 6f046a4..f9c0b8a 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -94,7 +94,7 @@ swfdec_as_array_get_length (SwfdecAsObject *array)
 {
   gint32 length;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (array), 0);
+  g_return_val_if_fail (array != NULL, 0);
 
   length = swfdec_as_array_length_as_integer (array);
 
@@ -110,7 +110,7 @@ swfdec_as_array_set_length_object (SwfdecAsObject *object, gint32 length)
   SwfdecAsValue val;
   gboolean was_array;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
 
   was_array = object->array;
   object->array = FALSE;
@@ -135,7 +135,7 @@ swfdec_as_array_set_length (SwfdecAsObject *array, gint32 length)
 {
   SwfdecAsValue val;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (array));
+  g_return_if_fail (array != NULL);
   g_return_if_fail (length >= 0);
 
   swfdec_as_value_set_integer (swfdec_gc_object_get_context (array), &val, length);
@@ -223,7 +223,7 @@ swfdec_as_array_move_range (SwfdecAsObject *object, gint32 from_index,
 {
   ForeachMoveRangeData fdata = { from_index, num, to_index };
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (from_index >= 0);
   g_return_if_fail (num >= 0);
   g_return_if_fail (to_index >= 0);
@@ -248,7 +248,7 @@ swfdec_as_array_set_range_with_flags (SwfdecAsObject *object,
   const char *var;
 
   // allow negative indexes
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (num >= 0);
   g_return_if_fail (num == 0 || value != NULL);
 
@@ -316,7 +316,7 @@ void
 swfdec_as_array_append_with_flags (SwfdecAsObject *array, guint n,
     const SwfdecAsValue *value, SwfdecAsVariableFlag flags)
 {
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (array));
+  g_return_if_fail (array != NULL);
   g_return_if_fail (n == 0 || value != NULL);
 
   // don't allow negative length
@@ -350,7 +350,7 @@ swfdec_as_array_insert_with_flags (SwfdecAsObject *array, gint32 idx,
 {
   gint32 length;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (array));
+  g_return_if_fail (array != NULL);
   g_return_if_fail (idx >= 0);
   g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
 
@@ -374,7 +374,7 @@ swfdec_as_array_remove (SwfdecAsObject *array, gint32 idx)
 {
   gint32 length;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (array));
+  g_return_if_fail (array != NULL);
   g_return_if_fail (idx >= 0);
 
   length = swfdec_as_array_get_length (array);
@@ -401,7 +401,7 @@ swfdec_as_array_get_value (SwfdecAsObject *array, gint32 idx,
 {
   const char *var;
 
-  g_assert (SWFDEC_IS_AS_OBJECT (array));
+  g_assert (array != NULL);
   g_assert (idx >= 0);
   g_assert (value != NULL);
 
@@ -424,7 +424,7 @@ swfdec_as_array_set_value (SwfdecAsObject *array, gint32 idx,
 {
   const char *var;
 
-  g_assert (SWFDEC_IS_AS_OBJECT (array));
+  g_assert (array != NULL);
   g_assert (idx >= 0);
   g_assert (SWFDEC_IS_AS_VALUE (value));
 
@@ -463,8 +463,8 @@ swfdec_as_array_append_array_range (SwfdecAsObject *array_to,
 {
   ForeachAppendArrayRangeData fdata;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (array_to));
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object_from));
+  g_return_if_fail (array_to != NULL);
+  g_return_if_fail (object_from != NULL);
   g_return_if_fail (start_index >= 0);
 
   if (num == 0)
@@ -1056,7 +1056,7 @@ swfdec_as_array_do_sort (SwfdecAsContext *cx, SwfdecAsObject *object,
   gboolean descending;
 
   g_return_if_fail (SWFDEC_IS_AS_CONTEXT (cx));
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (options != NULL);
   g_return_if_fail (custom_function == NULL ||
       SWFDEC_IS_AS_FUNCTION (custom_function));
diff --git a/swfdec/swfdec_as_frame.c b/swfdec/swfdec_as_frame.c
index 84b3dec..5fda086 100644
--- a/swfdec/swfdec_as_frame.c
+++ b/swfdec/swfdec_as_frame.c
@@ -342,7 +342,7 @@ swfdec_as_frame_set_this (SwfdecAsFrame *frame, SwfdecAsObject *thisp)
 {
   g_return_if_fail (frame != NULL);
   g_return_if_fail (SWFDEC_AS_VALUE_IS_UNDEFINED (&frame->thisp));
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (thisp));
+  g_return_if_fail (thisp != NULL);
 
   g_assert (!SWFDEC_IS_AS_SUPER (thisp));
   SWFDEC_AS_VALUE_SET_COMPOSITE (&frame->thisp, thisp);
diff --git a/swfdec/swfdec_as_function.c b/swfdec/swfdec_as_function.c
index 63ccf15..3b2d587 100644
--- a/swfdec/swfdec_as_function.c
+++ b/swfdec/swfdec_as_function.c
@@ -96,8 +96,6 @@ swfdec_as_function_call_full (SwfdecAsFunction *function, SwfdecAsObject *thisp,
   SwfdecAsFunctionClass *klass;
 
   g_return_if_fail (SWFDEC_IS_AS_FUNCTION (function));
-  g_return_if_fail (thisp == NULL || SWFDEC_IS_AS_OBJECT (thisp));
-  g_return_if_fail (super_reference == NULL || SWFDEC_IS_AS_OBJECT (super_reference));
 
   klass = SWFDEC_AS_FUNCTION_GET_CLASS (function);
   klass->call (function, thisp, construct, super_reference, n_args, args, return_value);
diff --git a/swfdec/swfdec_as_interpret.c b/swfdec/swfdec_as_interpret.c
index e0ac09f..1e237b4 100644
--- a/swfdec/swfdec_as_interpret.c
+++ b/swfdec/swfdec_as_interpret.c
@@ -2224,8 +2224,8 @@ swfdec_action_is_instance_of (SwfdecAsObject *object,
   SwfdecAsObject *class, *prototype;
   GSList *iter;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (constructor), FALSE);
+  g_return_val_if_fail (object != NULL, FALSE);
+  g_return_val_if_fail (constructor != NULL, FALSE);
 
   // FIXME: propflag tests are wrong, and we shouldn't get __proto__.prototype
   swfdec_as_object_get_variable (constructor, SWFDEC_AS_STR_prototype, &val);
diff --git a/swfdec/swfdec_as_object.c b/swfdec/swfdec_as_object.c
index 5e4be39..106dcc5 100644
--- a/swfdec/swfdec_as_object.c
+++ b/swfdec/swfdec_as_object.c
@@ -332,7 +332,7 @@ swfdec_as_object_get_prototype_internal (SwfdecAsObject *object)
 {
   int version;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
 
   version = swfdec_gc_object_get_context (object)->version;
 
@@ -365,7 +365,7 @@ swfdec_as_object_get_prototype (SwfdecAsObject *object)
   int version;
   SwfdecAsObject *prototype;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
 
   version = swfdec_gc_object_get_context (object)->version;
 
@@ -483,7 +483,7 @@ swfdec_as_object_foreach_remove (SwfdecAsObject *object, SwfdecAsVariableForeach
 {
   ForeachRemoveData fdata = { object, func, data };
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), 0);
+  g_return_val_if_fail (object != NULL, 0);
   g_return_val_if_fail (func != NULL, 0);
 
   return g_hash_table_foreach_remove (object->properties,
@@ -530,7 +530,7 @@ swfdec_as_object_foreach_rename (SwfdecAsObject *object, SwfdecAsVariableForeach
 {
   ForeachRenameData fdata = { object, NULL, func, data };
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (func != NULL);
 
   fdata.properties_new = g_hash_table_new (g_direct_hash, g_direct_equal);
@@ -667,7 +667,7 @@ swfdec_as_object_set_variable_and_flags (SwfdecAsObject *object,
   SwfdecAsObject *proto;
   SwfdecAsContext *context;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
   g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
 
@@ -881,7 +881,7 @@ swfdec_as_object_get_variable_and_flags (SwfdecAsObject *object,
   guint tmp_flags;
   SwfdecAsObject *tmp_pobject, *cur, *resolve;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
+  g_return_val_if_fail (object != NULL, FALSE);
   g_return_val_if_fail (variable != NULL, FALSE);
 
   context = swfdec_gc_object_get_context (object);
@@ -1011,7 +1011,7 @@ swfdec_as_object_has_variable (SwfdecAsObject *object, const char *variable)
   guint i;
   SwfdecAsVariable *var;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
+  g_return_val_if_fail (object != NULL, FALSE);
   
   for (i = 0; i <= SWFDEC_AS_OBJECT_PROTOTYPE_RECURSION_LIMIT && object != NULL; i++) {
     var = swfdec_as_object_hash_lookup (object, variable);
@@ -1039,7 +1039,7 @@ swfdec_as_object_delete_variable (SwfdecAsObject *object, const char *variable)
 {
   SwfdecAsVariable *var;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
+  g_return_val_if_fail (object != NULL, FALSE);
   g_return_val_if_fail (variable != NULL, FALSE);
 
   var = g_hash_table_lookup (object->properties, variable);
@@ -1066,7 +1066,7 @@ swfdec_as_object_delete_variable (SwfdecAsObject *object, const char *variable)
 void
 swfdec_as_object_delete_all_variables (SwfdecAsObject *object)
 {
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
 
   g_hash_table_foreach (object->properties, swfdec_as_object_free_property, object);
   g_hash_table_remove_all (object->properties);
@@ -1086,7 +1086,7 @@ swfdec_as_object_set_variable_flags (SwfdecAsObject *object,
 {
   SwfdecAsVariable *var;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
 
   var = swfdec_as_object_hash_lookup (object, variable);
@@ -1115,7 +1115,7 @@ swfdec_as_object_unset_variable_flags (SwfdecAsObject *object,
   SwfdecAsVariable *var;
   
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
 
   var = swfdec_as_object_hash_lookup (object, variable);
@@ -1145,7 +1145,7 @@ swfdec_as_object_foreach (SwfdecAsObject *object, SwfdecAsVariableForeach func,
 {
   ForeachData fdata = { object, func, data, TRUE };
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), FALSE);
+  g_return_val_if_fail (object != NULL, FALSE);
   g_return_val_if_fail (func != NULL, FALSE);
 
   /* FIXME: does not do Adobe Flash's order for Enumerate actions */
@@ -1198,7 +1198,7 @@ swfdec_as_object_add_function (SwfdecAsObject *object, const char *name, SwfdecA
   SwfdecAsContext *cx;
   SwfdecAsValue val;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
   cx = swfdec_gc_object_get_context (object);
@@ -1228,7 +1228,7 @@ swfdec_as_object_run (SwfdecAsObject *object, SwfdecScript *script)
   SwfdecAsFrame frame = { NULL, };
   SwfdecAsContext *context;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (script != NULL);
 
   context = swfdec_gc_object_get_context (object);
@@ -1273,7 +1273,7 @@ swfdec_as_object_call (SwfdecAsObject *object, const char *name, guint argc,
   SwfdecAsValue tmp;
   SwfdecAsFunction *fun;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), TRUE);
+  g_return_val_if_fail (object != NULL, TRUE);
   g_return_val_if_fail (name != NULL, TRUE);
   g_return_val_if_fail (argc == 0 || argv != NULL, TRUE);
   g_return_val_if_fail (swfdec_gc_object_get_context (object)->global != NULL, TRUE); /* for SwfdecPlayer */
@@ -1337,7 +1337,7 @@ swfdec_as_object_set_constructor_by_name (SwfdecAsObject *object, const char *na
   SwfdecAsObject *ret;
   va_list args;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
   va_start (args, name);
@@ -1354,7 +1354,7 @@ swfdec_as_object_set_constructor_by_namev (SwfdecAsObject *object,
   SwfdecAsObject *cur;
   SwfdecAsValue *val;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
   context = swfdec_gc_object_get_context (object);
@@ -1390,8 +1390,8 @@ swfdec_as_object_set_constructor (SwfdecAsObject *object, SwfdecAsObject *constr
 {
   SwfdecAsValue val;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (construct));
+  g_return_if_fail (object != NULL);
+  g_return_if_fail (construct != NULL);
 
   SWFDEC_AS_VALUE_SET_OBJECT (&val, construct);
   swfdec_as_object_set_variable_and_flags (object, SWFDEC_AS_STR_constructor, 
@@ -1425,7 +1425,7 @@ swfdec_as_object_add_variable (SwfdecAsObject *object, const char *variable,
 {
   SwfdecAsVariable *var;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
   g_return_if_fail (SWFDEC_IS_AS_FUNCTION (get));
   g_return_if_fail (set == NULL || SWFDEC_IS_AS_FUNCTION (set));
@@ -1445,7 +1445,7 @@ swfdec_as_object_add_native_variable (SwfdecAsObject *object,
 {
   SwfdecAsFunction *get_func, *set_func;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (variable != NULL);
   g_return_if_fail (get != NULL);
 
@@ -1697,7 +1697,7 @@ swfdec_as_object_decode (SwfdecAsObject *object, const char *str)
   char **varlist, *p, *unescaped;
   guint i;
 
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (str != NULL);
 
   varlist = g_strsplit (str, "&", -1);
@@ -1828,7 +1828,7 @@ swfdec_as_object_init_context (SwfdecAsContext *context)
 SwfdecAsObject *
 swfdec_as_object_resolve (SwfdecAsObject *object)
 {
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
 
   if (G_UNLIKELY (object->super))
     return SWFDEC_AS_SUPER (object->relay)->thisp;
@@ -1839,7 +1839,7 @@ swfdec_as_object_resolve (SwfdecAsObject *object)
 void
 swfdec_as_object_set_relay (SwfdecAsObject *object, SwfdecAsRelay *relay)
 {
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   if (relay) {
     g_return_if_fail (SWFDEC_IS_AS_RELAY (relay));
     g_return_if_fail (relay->relay == NULL);
diff --git a/swfdec/swfdec_as_super.c b/swfdec/swfdec_as_super.c
index 46898fe..e258a06 100644
--- a/swfdec/swfdec_as_super.c
+++ b/swfdec/swfdec_as_super.c
@@ -82,8 +82,7 @@ swfdec_as_super_new (SwfdecAsFrame *frame, SwfdecAsObject *thisp, SwfdecAsObject
   SwfdecAsSuper *super;
 
   g_return_if_fail (frame != NULL);
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (thisp));
-  g_return_if_fail (ref == NULL || SWFDEC_IS_AS_OBJECT (ref));
+  g_return_if_fail (thisp != NULL);
   
   if (frame->super != NULL)
     return;
diff --git a/swfdec/swfdec_event.c b/swfdec/swfdec_event.c
index 643068c..d8f2843 100644
--- a/swfdec/swfdec_event.c
+++ b/swfdec/swfdec_event.c
@@ -175,7 +175,7 @@ swfdec_event_list_execute (SwfdecEventList *list, SwfdecAsObject *object,
   guint i;
 
   g_return_if_fail (list != NULL);
-  g_return_if_fail (SWFDEC_IS_AS_OBJECT (object));
+  g_return_if_fail (object != NULL);
   g_return_if_fail (condition < N_CONDITIONS);
 
   condition = (1 << condition);
diff --git a/swfdec/swfdec_load_sound.c b/swfdec/swfdec_load_sound.c
index 9b46be1..abccb35 100644
--- a/swfdec/swfdec_load_sound.c
+++ b/swfdec/swfdec_load_sound.c
@@ -404,7 +404,7 @@ swfdec_load_sound_new (SwfdecAsObject *target, const char *url)
   SwfdecAsContext *context;
   char *missing;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (target), NULL);
+  g_return_val_if_fail (target != NULL, NULL);
   g_return_val_if_fail (url != NULL, NULL);
 
   context = swfdec_gc_object_get_context (target);
diff --git a/swfdec/swfdec_player.c b/swfdec/swfdec_player.c
index 4b204dc..a6b05cf 100644
--- a/swfdec/swfdec_player.c
+++ b/swfdec/swfdec_player.c
@@ -2783,7 +2783,6 @@ swfdec_player_set_export_class (SwfdecPlayer *player, const char *name, SwfdecAs
 
   g_return_if_fail (SWFDEC_IS_PLAYER (player));
   g_return_if_fail (name != NULL);
-  g_return_if_fail (object == NULL || SWFDEC_IS_AS_OBJECT (object));
 
   priv = player->priv;
   if (object) {
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 72db3c8..1ea2dd7 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -765,7 +765,6 @@ swfdec_sprite_movie_init_from_object (SwfdecMovie *movie,
     SwfdecAsObject *initObject)
 {
   g_return_if_fail (SWFDEC_IS_MOVIE (movie));
-  g_return_if_fail (initObject == NULL || SWFDEC_IS_AS_OBJECT (initObject));
 
   if (initObject != NULL) {
     SwfdecAsContext *cx = swfdec_gc_object_get_context (movie);
diff --git a/swfdec/swfdec_style_sheet.c b/swfdec/swfdec_style_sheet.c
index c23f96d..8faf046 100644
--- a/swfdec/swfdec_style_sheet.c
+++ b/swfdec/swfdec_style_sheet.c
@@ -65,7 +65,7 @@ swfdec_style_sheet_get_selector_object (SwfdecAsObject *object,
   SwfdecAsValue val;
   SwfdecAsObject *empty;
 
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (name != NULL, NULL);
 
   empty = swfdec_as_object_new_empty (swfdec_gc_object_get_context (object));
@@ -85,7 +85,7 @@ swfdec_style_sheet_parse_selectors (SwfdecAsContext *cx, const char *p,
   const char *name;
 
   g_return_val_if_fail (p != NULL && p != '\0' && !g_ascii_isspace (*p), NULL);
-  g_return_val_if_fail (SWFDEC_IS_AS_OBJECT (object), NULL);
+  g_return_val_if_fail (object != NULL, NULL);
   g_return_val_if_fail (selectors != NULL, NULL);
 
   p += strspn (p, " \t\r\n,");


More information about the Swfdec-commits mailing list