[Swfdec-commits] 9 commits - swfdec/swfdec_as_array.c swfdec/swfdec_as_context.c swfdec/swfdec_resource.c swfdec/swfdec_sprite_movie_as.c swfdec/swfdec_style_sheet.c test/trace
Benjamin Otte
company at kemper.freedesktop.org
Mon Nov 3 14:21:15 PST 2008
swfdec/swfdec_as_array.c | 28 ++++++++++++----------------
swfdec/swfdec_as_context.c | 9 +--------
swfdec/swfdec_resource.c | 1 +
swfdec/swfdec_sprite_movie_as.c | 31 +++++++++++++++++++------------
swfdec/swfdec_style_sheet.c | 2 +-
test/trace/Makefile.am | 9 +++++++++
test/trace/crash-0.8.2-gotoAndPlay-5.swf |binary
test/trace/crash-0.8.2-gotoAndPlay-6.swf |binary
test/trace/crash-0.8.2-gotoAndPlay-7.swf |binary
test/trace/crash-0.8.2-gotoAndPlay-8.swf |binary
test/trace/crash-0.8.2-gotoAndPlay.as | 7 +++++++
11 files changed, 50 insertions(+), 37 deletions(-)
New commits:
commit e645dc20d606ccce7c1ed014ac2cbe4c67caef24
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 23:14:01 2008 +0100
remove unnecessary casts from SWFDEC_AS_CHECK calls
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index 8c7cfd9..faabd06 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -416,7 +416,7 @@ swfdec_sprite_movie_play (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecSpriteMovie *movie;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, &movie, "");
movie->playing = TRUE;
}
@@ -428,7 +428,7 @@ swfdec_sprite_movie_stop (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecSpriteMovie *movie;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, &movie, "");
movie->playing = FALSE;
}
@@ -441,7 +441,7 @@ swfdec_sprite_movie_getBytesLoaded (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecMovie *movie;
SwfdecResource *resource;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
resource = swfdec_movie_get_own_resource (movie);
if (resource && resource->decoder) {
@@ -459,7 +459,7 @@ swfdec_sprite_movie_getBytesTotal (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecMovie *movie;
SwfdecResource *resource;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
resource = swfdec_movie_get_own_resource (movie);
if (resource) {
@@ -481,7 +481,7 @@ swfdec_sprite_movie_getNextHighestDepth (SwfdecAsContext *cx, SwfdecAsObject *ob
SwfdecMovie *movie;
int depth;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
if (movie->list) {
depth = SWFDEC_MOVIE (g_list_last (movie->list)->data)->depth + 1;
@@ -526,7 +526,7 @@ swfdec_sprite_movie_gotoAndPlay (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecSpriteMovie *movie;
SwfdecAsValue val;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "v", &val);
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, &movie, "v", &val);
if (movie->sprite == NULL)
return;
@@ -543,7 +543,7 @@ swfdec_sprite_movie_gotoAndStop (SwfdecAsContext *cx, SwfdecAsObject *object,
SwfdecSpriteMovie *movie;
SwfdecAsValue val;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "v", &val);
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, &movie, "v", &val);
if (movie->sprite == NULL)
return;
@@ -559,7 +559,7 @@ swfdec_sprite_movie_nextFrame (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecSpriteMovie *movie;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, &movie, "");
swfdec_sprite_movie_goto (movie, movie->frame + 1);
movie->playing = FALSE;
@@ -572,7 +572,7 @@ swfdec_sprite_movie_prevFrame (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecSpriteMovie *movie;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, &movie, "");
swfdec_sprite_movie_goto (movie, movie->frame - 1);
movie->playing = FALSE;
@@ -853,7 +853,7 @@ swfdec_sprite_movie_duplicateMovieClip (SwfdecAsContext *cx, SwfdecAsObject *obj
const char *name;
int depth;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "si", &name, &depth);
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "si", &name, &depth);
if (swfdec_depth_classify (depth) == SWFDEC_DEPTH_CLASS_EMPTY)
return;
@@ -872,7 +872,7 @@ swfdec_sprite_movie_removeMovieClip (SwfdecAsContext *cx, SwfdecAsObject *object
{
SwfdecMovie *movie;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
if (swfdec_depth_classify (movie->depth) == SWFDEC_DEPTH_CLASS_DYNAMIC)
swfdec_movie_remove (movie);
@@ -885,7 +885,7 @@ swfdec_sprite_movie_getDepth (SwfdecAsContext *cx, SwfdecAsObject *object,
{
SwfdecMovie *movie;
- SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, (gpointer)&movie, "");
+ SWFDEC_AS_CHECK (SWFDEC_TYPE_MOVIE, &movie, "");
swfdec_as_value_set_integer (cx, rval, movie->depth);
}
commit d69c217f98378ad6aa6d43b1e4b573d04a653222
Merge: 89601a3... 5a0eee2...
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 23:09:12 2008 +0100
Merge branch '0.8'
Conflicts:
test/trace/Makefile.am
diff --cc test/trace/Makefile.am
index 228fba4,62322f7..58876a7
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@@ -1059,15 -1022,15 +1059,24 @@@ EXTRA_DIST =
crash-0.8.0-huffmann-table-8.swf \
crash-0.8.0-huffmann-table-8.swf.trace \
crash-0.8.0-huffmann-table.xml \
+ crash-0.8.2-gotoAndPlay-5.swf \
+ crash-0.8.2-gotoAndPlay-5.swf.trace \
+ crash-0.8.2-gotoAndPlay-6.swf \
+ crash-0.8.2-gotoAndPlay-6.swf.trace \
+ crash-0.8.2-gotoAndPlay-7.swf \
+ crash-0.8.2-gotoAndPlay-7.swf.trace \
+ crash-0.8.2-gotoAndPlay-8.swf \
+ crash-0.8.2-gotoAndPlay-8.swf.trace \
+ crash-0.8.2-gotoAndPlay.as \
+ crash-0.9.1-getvariable-shapes-5.swf \
+ crash-0.9.1-getvariable-shapes-5.swf.trace \
+ crash-0.9.1-getvariable-shapes-6.swf \
+ crash-0.9.1-getvariable-shapes-6.swf.trace \
+ crash-0.9.1-getvariable-shapes-7.swf \
+ crash-0.9.1-getvariable-shapes-7.swf.trace \
+ crash-0.9.1-getvariable-shapes-8.swf \
+ crash-0.9.1-getvariable-shapes-8.swf.trace \
+ crash-0.9.1-getvariable-shapes.xml \
createEmptyMovieClip-events.sc \
createEmptyMovieClip-events.swf \
createEmptyMovieClip-events.swf.trace \
commit 5a0eee23234820e60dc4c175ac693015240fad9e
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 23:08:15 2008 +0100
add test for gotoAndPlay crash
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 5e674e0..62322f7 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -1022,6 +1022,15 @@ EXTRA_DIST = \
crash-0.8.0-huffmann-table-8.swf \
crash-0.8.0-huffmann-table-8.swf.trace \
crash-0.8.0-huffmann-table.xml \
+ crash-0.8.2-gotoAndPlay-5.swf \
+ crash-0.8.2-gotoAndPlay-5.swf.trace \
+ crash-0.8.2-gotoAndPlay-6.swf \
+ crash-0.8.2-gotoAndPlay-6.swf.trace \
+ crash-0.8.2-gotoAndPlay-7.swf \
+ crash-0.8.2-gotoAndPlay-7.swf.trace \
+ crash-0.8.2-gotoAndPlay-8.swf \
+ crash-0.8.2-gotoAndPlay-8.swf.trace \
+ crash-0.8.2-gotoAndPlay.as \
createEmptyMovieClip-events.sc \
createEmptyMovieClip-events.swf \
createEmptyMovieClip-events.swf.trace \
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-5.swf b/test/trace/crash-0.8.2-gotoAndPlay-5.swf
new file mode 100644
index 0000000..cca9dc9
Binary files /dev/null and b/test/trace/crash-0.8.2-gotoAndPlay-5.swf differ
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-5.swf.trace b/test/trace/crash-0.8.2-gotoAndPlay-5.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-6.swf b/test/trace/crash-0.8.2-gotoAndPlay-6.swf
new file mode 100644
index 0000000..85b549e
Binary files /dev/null and b/test/trace/crash-0.8.2-gotoAndPlay-6.swf differ
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-6.swf.trace b/test/trace/crash-0.8.2-gotoAndPlay-6.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-7.swf b/test/trace/crash-0.8.2-gotoAndPlay-7.swf
new file mode 100644
index 0000000..c7a02f4
Binary files /dev/null and b/test/trace/crash-0.8.2-gotoAndPlay-7.swf differ
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-7.swf.trace b/test/trace/crash-0.8.2-gotoAndPlay-7.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-8.swf b/test/trace/crash-0.8.2-gotoAndPlay-8.swf
new file mode 100644
index 0000000..3bf0c5d
Binary files /dev/null and b/test/trace/crash-0.8.2-gotoAndPlay-8.swf differ
diff --git a/test/trace/crash-0.8.2-gotoAndPlay-8.swf.trace b/test/trace/crash-0.8.2-gotoAndPlay-8.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.8.2-gotoAndPlay.as b/test/trace/crash-0.8.2-gotoAndPlay.as
new file mode 100644
index 0000000..a9391fe
--- /dev/null
+++ b/test/trace/crash-0.8.2-gotoAndPlay.as
@@ -0,0 +1,7 @@
+// makeswf -v 7 -s 200x150 -r 1 -o crash-0.8.2-gotoAndPlay.swf crash-0.8.2-gotoAndPlay.as
+
+createEmptyMovieClip ("a", 0);
+a.gotoAndPlay ("hi");
+a.gotoAndStop ("ho");
+
+getURL ("fscommand:quit", "");
commit 9666246059792a2ab3b357eacfd62260925daddd
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 23:07:46 2008 +0100
fix crash when calling gotoAndPlay (label) on a script-created movieclip
diff --git a/swfdec/swfdec_sprite_movie_as.c b/swfdec/swfdec_sprite_movie_as.c
index b1bb452..191f83e 100644
--- a/swfdec/swfdec_sprite_movie_as.c
+++ b/swfdec/swfdec_sprite_movie_as.c
@@ -470,6 +470,7 @@ swfdec_sprite_movie_do_goto (SwfdecSpriteMovie *movie, SwfdecAsValue *target)
int frame;
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)) {
@@ -498,6 +499,9 @@ swfdec_sprite_movie_gotoAndPlay (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "v", &val);
+ if (movie->sprite == NULL)
+ return;
+
swfdec_sprite_movie_do_goto (movie, &val);
movie->playing = TRUE;
}
@@ -512,6 +516,9 @@ swfdec_sprite_movie_gotoAndStop (SwfdecAsContext *cx, SwfdecAsObject *object,
SWFDEC_AS_CHECK (SWFDEC_TYPE_SPRITE_MOVIE, (gpointer)&movie, "v", &val);
+ if (movie->sprite == NULL)
+ return;
+
swfdec_sprite_movie_do_goto (movie, &val);
movie->playing = FALSE;
}
commit 89601a3e56a0ed2bc83b6c79877a9b1804cb675e
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 22:41:04 2008 +0100
mark the movie, too
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 3dee52e..2faa260 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -386,6 +386,7 @@ swfdec_resource_mark (SwfdecGcObject *object)
swfdec_gc_object_mark (resource->sandbox);
if (resource->target)
swfdec_gc_object_mark (resource->target);
+ swfdec_as_value_mark (&resource->movie);
SWFDEC_GC_OBJECT_CLASS (swfdec_resource_parent_class)->mark (object);
}
commit cf6f540ba79c16bd95f5f48edacc56598af05c2f
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 22:24:38 2008 +0100
whoops, array cleanup patch caused SEGVs - fix them
diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index 1b90bd8..6f046a4 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -349,13 +349,12 @@ swfdec_as_array_insert_with_flags (SwfdecAsObject *array, gint32 idx,
const SwfdecAsValue *value, SwfdecAsVariableFlag flags)
{
gint32 length;
- SwfdecAsObject *object;
g_return_if_fail (SWFDEC_IS_AS_OBJECT (array));
g_return_if_fail (idx >= 0);
g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
- length = swfdec_as_array_get_length (object);
+ length = swfdec_as_array_get_length (array);
if (idx < length)
swfdec_as_array_move_range (array, idx, length - idx, idx + 1);
commit 6f6b87f9c60ce2ba95fa8422e31106a4303d571c
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 21:10:48 2008 +0100
fix documentation
--- by removing an example
diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 6a12693..61af6b2 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -689,14 +689,7 @@ swfdec_as_context_is_constructing (SwfdecAsContext *context)
* @context: a #SwfdecAsContext
*
* This is a debugging function. It gets the topmost stack frame that is
- * currently executing. If no function is executing, %NULL is returned. You can
- * easily get a backtrace with code like this:
- * |[for (frame = swfdec_as_context_get_frame (context); frame != NULL;
- * frame = swfdec_as_frame_get_next (frame)) {
- * char *s = swfdec_as_object_get_debug (SWFDEC_AS_OBJECT (frame));
- * g_print ("%s\n", s);
- * g_free (s);
- * }]|
+ * currently executing. If no function is executing, %NULL is returned.
*
* Returns: the currently executing frame or %NULL if none
**/
commit c4320131ba1d52560b9dfc15359e77d04608deb3
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 21:10:07 2008 +0100
remove unecessary array casts
diff --git a/swfdec/swfdec_as_array.c b/swfdec/swfdec_as_array.c
index a5865ba..1b90bd8 100644
--- a/swfdec/swfdec_as_array.c
+++ b/swfdec/swfdec_as_array.c
@@ -139,7 +139,7 @@ swfdec_as_array_set_length (SwfdecAsObject *array, gint32 length)
g_return_if_fail (length >= 0);
swfdec_as_value_set_integer (swfdec_gc_object_get_context (array), &val, length);
- swfdec_as_object_set_variable_and_flags (SWFDEC_AS_OBJECT (array),
+ swfdec_as_object_set_variable_and_flags (array,
SWFDEC_AS_STR_length, &val,
SWFDEC_AS_VARIABLE_HIDDEN | SWFDEC_AS_VARIABLE_PERMANENT);
}
@@ -320,8 +320,8 @@ swfdec_as_array_append_with_flags (SwfdecAsObject *array, guint n,
g_return_if_fail (n == 0 || value != NULL);
// don't allow negative length
- swfdec_as_array_set_range_with_flags (SWFDEC_AS_OBJECT (array),
- swfdec_as_array_get_length (SWFDEC_AS_OBJECT (array)), n, value, flags);
+ swfdec_as_array_set_range_with_flags (array,
+ swfdec_as_array_get_length (array), n, value, flags);
}
/**
@@ -355,12 +355,11 @@ swfdec_as_array_insert_with_flags (SwfdecAsObject *array, gint32 idx,
g_return_if_fail (idx >= 0);
g_return_if_fail (SWFDEC_IS_AS_VALUE (value));
- object = SWFDEC_AS_OBJECT (array);
length = swfdec_as_array_get_length (object);
if (idx < length)
- swfdec_as_array_move_range (object, idx, length - idx, idx + 1);
- swfdec_as_array_set_range_with_flags (object, idx, 1, value, flags);
+ swfdec_as_array_move_range (array, idx, length - idx, idx + 1);
+ swfdec_as_array_set_range_with_flags (array, idx, 1, value, flags);
}
/**
@@ -375,18 +374,16 @@ void
swfdec_as_array_remove (SwfdecAsObject *array, gint32 idx)
{
gint32 length;
- SwfdecAsObject *object;
g_return_if_fail (SWFDEC_IS_AS_OBJECT (array));
g_return_if_fail (idx >= 0);
- object = SWFDEC_AS_OBJECT (array);
- length = swfdec_as_array_get_length (object);
+ length = swfdec_as_array_get_length (array);
if (idx >= length)
return;
- swfdec_as_array_move_range (object, idx + 1, length - (idx + 1), idx);
+ swfdec_as_array_move_range (array, idx + 1, length - (idx + 1), idx);
swfdec_as_array_set_length (array, length - 1);
}
@@ -410,7 +407,7 @@ swfdec_as_array_get_value (SwfdecAsObject *array, gint32 idx,
g_assert (value != NULL);
var = swfdec_as_integer_to_string (swfdec_gc_object_get_context (array), idx);
- swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (array), var, value);
+ swfdec_as_object_get_variable (array, var, value);
}
/**
@@ -433,7 +430,7 @@ swfdec_as_array_set_value (SwfdecAsObject *array, gint32 idx,
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 (SWFDEC_AS_OBJECT (array), var, value);
+ swfdec_as_object_set_variable (array, var, value);
}
typedef struct {
@@ -474,8 +471,8 @@ swfdec_as_array_append_array_range (SwfdecAsObject *array_to,
if (num == 0)
return;
- fdata.object_to = SWFDEC_AS_OBJECT (array_to);
- fdata.offset = swfdec_as_array_get_length (SWFDEC_AS_OBJECT (array_to));
+ fdata.object_to = array_to;
+ fdata.offset = swfdec_as_array_get_length (array_to);
fdata.start_index = start_index;
fdata.num = num;
commit 1a122926eb6857974c64a750f8e47f0ad3eceda7
Author: Benjamin Otte <otte at gnome.org>
Date: Mon Nov 3 21:07:34 2008 +0100
fix another case of missed relay transition
diff --git a/swfdec/swfdec_style_sheet.c b/swfdec/swfdec_style_sheet.c
index d1a1546..c23f96d 100644
--- a/swfdec/swfdec_style_sheet.c
+++ b/swfdec/swfdec_style_sheet.c
@@ -331,7 +331,7 @@ swfdec_style_sheet_get_format (SwfdecStyleSheet *style, const char *name)
g_return_val_if_fail (SWFDEC_IS_STYLE_SHEET (style), NULL);
g_return_val_if_fail (name != NULL, NULL);
- swfdec_as_object_get_variable (SWFDEC_AS_OBJECT (style),
+ swfdec_as_object_get_variable (swfdec_as_relay_get_as_object (SWFDEC_AS_RELAY (style)),
SWFDEC_AS_STR__styles, &val);
swfdec_as_value_get_variable (swfdec_gc_object_get_context (style), &val, name, &val);
if (!SWFDEC_AS_VALUE_IS_OBJECT (&val))
More information about the Swfdec-commits
mailing list