[Swfdec-commits] 8 commits - swfdec/swfdec_actor.c swfdec/swfdec_as_context.c swfdec/swfdec_as_strings.c swfdec/swfdec_event.c swfdec/swfdec_event.h swfdec/swfdec_player_internal.h swfdec/swfdec_resource.c swfdec/swfdec_sprite_movie.c swfdec/swfdec_text_field_movie.c swfdec/swfdec_text_format.c test/trace

Benjamin Otte company at kemper.freedesktop.org
Fri Apr 4 10:10:04 PDT 2008


 swfdec/swfdec_actor.c                                     |   10 +
 swfdec/swfdec_as_context.c                                |    3 
 swfdec/swfdec_as_strings.c                                |    1 
 swfdec/swfdec_event.c                                     |    6 -
 swfdec/swfdec_event.h                                     |    7 +
 swfdec/swfdec_player_internal.h                           |    4 
 swfdec/swfdec_resource.c                                  |    6 -
 swfdec/swfdec_sprite_movie.c                              |    9 -
 swfdec/swfdec_text_field_movie.c                          |    4 
 swfdec/swfdec_text_format.c                               |   84 +++++++-------
 test/trace/Makefile.am                                    |   18 +++
 test/trace/crash-0.6.2-try-and-exception-on-dispose-5.swf |binary
 test/trace/crash-0.6.2-try-and-exception-on-dispose-6.swf |binary
 test/trace/crash-0.6.2-try-and-exception-on-dispose-7.swf |binary
 test/trace/crash-0.6.2-try-and-exception-on-dispose-8.swf |binary
 test/trace/crash-0.6.2-try-and-exception-on-dispose.as    |   14 ++
 test/trace/empty-string-text-extent-5.swf                 |binary
 test/trace/empty-string-text-extent-5.swf.trace           |    3 
 test/trace/empty-string-text-extent-6.swf                 |binary
 test/trace/empty-string-text-extent-6.swf.trace           |    3 
 test/trace/empty-string-text-extent-7.swf                 |binary
 test/trace/empty-string-text-extent-7.swf.trace           |    3 
 test/trace/empty-string-text-extent-8.swf                 |binary
 test/trace/empty-string-text-extent-8.swf.trace           |    3 
 test/trace/empty-string-text-extent.as                    |   11 +
 25 files changed, 138 insertions(+), 51 deletions(-)

New commits:
commit d4b651fa0f20e607b531b96fb926971d94edcc7f
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 18:59:34 2008 +0200

    compute right start index

diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index 2ff7f06..d348eae 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -2027,8 +2027,8 @@ swfdec_text_field_movie_replace_text (SwfdecTextFieldMovie *text,
     /* adapt indexes: remove deleted part, add to-be inserted text */
     if (findex->index_ > end_index) {
       findex->index_ = findex->index_ + start_index - end_index + len;
-    } else if (findex->index_ >= start_index) {
-      findex->index_ = findex->index_ + start_index - end_index;
+    } else if (findex->index_ > start_index) {
+      findex->index_ = start_index;
     }
   }
 
commit 1d3a458d4095511cf91a7a0b2bf8d6847f7fe151
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 18:04:59 2008 +0200

    compute right offset for inserting text in replaceText

diff --git a/swfdec/swfdec_text_field_movie.c b/swfdec/swfdec_text_field_movie.c
index e96d39e..2ff7f06 100644
--- a/swfdec/swfdec_text_field_movie.c
+++ b/swfdec/swfdec_text_field_movie.c
@@ -2025,8 +2025,10 @@ swfdec_text_field_movie_replace_text (SwfdecTextFieldMovie *text,
       continue;
     }
     /* adapt indexes: remove deleted part, add to-be inserted text */
-    if (findex->index_ > start_index) {
+    if (findex->index_ > end_index) {
       findex->index_ = findex->index_ + start_index - end_index + len;
+    } else if (findex->index_ >= start_index) {
+      findex->index_ = findex->index_ + start_index - end_index;
     }
   }
 
commit b085c59458c3c3400db2fc6a76de991b695735c9
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 17:16:03 2008 +0200

    parse construct events again
    
    a recent commit masked them out

diff --git a/swfdec/swfdec_event.h b/swfdec/swfdec_event.h
index 0f04461..8d4ba68 100644
--- a/swfdec/swfdec_event.h
+++ b/swfdec/swfdec_event.h
@@ -52,7 +52,7 @@ typedef enum _SwfdecEventType {
   SWFDEC_EVENT_SCROLL = 20,
 } SwfdecEventType;
 
-#define SWFDEC_EVENT_MASK ((1 << SWFDEC_EVENT_CONSTRUCT) - 1)
+#define SWFDEC_EVENT_MASK ((1 << SWFDEC_EVENT_CHANGED) - 1)
 
 const char *		swfdec_event_type_get_name	(SwfdecEventType      type);
 
commit f6c0f2fe1a8c6ac720ceae5230e6a33df31b874f
Author: James Bowes <jbowes at dangerouslyinc.com>
Date:   Thu Apr 3 08:07:10 2008 -0400

    Fix getTextExtent on an empty string
    
    getTextExtent should set 0 for all the properties on the object it
    returns when passed an emptry string (rather than segfaulting).
    
    Add a test and fix the code.

diff --git a/swfdec/swfdec_text_format.c b/swfdec/swfdec_text_format.c
index 2f89d68..0b342f6 100644
--- a/swfdec/swfdec_text_format.c
+++ b/swfdec/swfdec_text_format.c
@@ -834,6 +834,8 @@ swfdec_text_format_getTextExtent (SwfdecAsContext *cx, SwfdecAsObject *object,
   SwfdecAsObject *obj = swfdec_as_object_new_empty (cx);
   SwfdecAsValue val;
   const gchar *text;
+  gint height = 0, width = 0,  text_field_width = 0, text_field_height = 0;
+  gint ascent = 0, descent = 0;
   GList *item_list;
   PangoAnalysis analysis;
   PangoFontMap *fontmap;
@@ -846,57 +848,65 @@ swfdec_text_format_getTextExtent (SwfdecAsContext *cx, SwfdecAsObject *object,
 
   SWFDEC_AS_CHECK (SWFDEC_TYPE_TEXT_FORMAT, &format, "s", &text);
 
-  fontmap = pango_cairo_font_map_get_default ();
-  pcontext =
-    pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
+  /* If the string is empty we'll just leave all the values as 0. */
+  if (text != SWFDEC_AS_STR_EMPTY){
+    fontmap = pango_cairo_font_map_get_default ();
+    pcontext =
+      pango_cairo_font_map_create_context (PANGO_CAIRO_FONT_MAP (fontmap));
 
-  attrs = pango_attr_list_new ();
-  item_list = pango_itemize (pcontext, text, 0, strlen(text), attrs, NULL);
-  pango_attr_list_unref (attrs);
+    attrs = pango_attr_list_new ();
+    item_list = pango_itemize (pcontext, text, 0, strlen (text), attrs, NULL);
+    pango_attr_list_unref (attrs);
 
-  analysis = ((PangoItem *)(item_list[0].data))->analysis;
-  pango_shape (text, strlen(text), &analysis, glyph_string);
+    analysis = ((PangoItem *)(item_list[0].data))->analysis;
+    pango_shape (text, strlen (text), &analysis, glyph_string);
 
-  desc = pango_font_description_new ();
-  pango_font_description_set_family_static (desc, format->font);
-  pango_font_description_set_size (desc, format->size * PANGO_SCALE);
-  if (format->bold){
-    pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
+    desc = pango_font_description_new ();
+    pango_font_description_set_family_static (desc, format->font);
+    pango_font_description_set_size (desc, format->size * PANGO_SCALE);
+    if (format->bold){
+      pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
+    }
+    if (format->italic)
+      pango_font_description_set_style (desc, PANGO_STYLE_ITALIC);
+
+    font = pango_font_map_load_font (fontmap, pcontext, desc);
+    pango_glyph_string_extents (glyph_string, font, &ink_rect, NULL);
+
+    pango_glyph_string_free (glyph_string);
+    g_list_foreach (item_list, (GFunc) pango_item_free, NULL);
+    g_list_free (item_list);
+    pango_font_description_free (desc);
+    g_object_unref (G_OBJECT (pcontext));
+    g_object_unref (G_OBJECT (fontmap));
+    g_object_unref (G_OBJECT (font));
+
+    width = ink_rect.width / PANGO_SCALE + format->left_margin
+	+ format->right_margin;
+    height = ink_rect.height / PANGO_SCALE + format->leading;
+    ascent = PANGO_ASCENT(ink_rect) / PANGO_SCALE;
+    descent = PANGO_DESCENT (ink_rect) / PANGO_SCALE;
+    text_field_width = ink_rect.width / PANGO_SCALE + format->left_margin
+	+ format->right_margin + 4;
+    text_field_height = ink_rect.height / PANGO_SCALE + 4 + format->leading;
   }
-  if (format->italic)
-    pango_font_description_set_style (desc, PANGO_STYLE_ITALIC);
-
-  font = pango_font_map_load_font (fontmap, pcontext, desc);
-  pango_glyph_string_extents (glyph_string, font, &ink_rect, NULL);
-
-  pango_glyph_string_free (glyph_string);
-  g_list_foreach (item_list, (GFunc) pango_item_free, NULL);
-  g_list_free (item_list);
-  pango_font_description_free (desc);
-  g_object_unref (G_OBJECT (pcontext));
-  g_object_unref (G_OBJECT (fontmap));
-  g_object_unref (G_OBJECT (font));
-
-  SWFDEC_AS_VALUE_SET_INT (&val, ink_rect.width / PANGO_SCALE +
-						   format->left_margin + format->right_margin);
+
+  SWFDEC_AS_VALUE_SET_INT (&val, width);
   swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_width, &val);
 
-  SWFDEC_AS_VALUE_SET_INT (&val, (ink_rect.height / PANGO_SCALE +
-								  format->leading));
+  SWFDEC_AS_VALUE_SET_INT (&val, height);
   swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_height, &val);
 
-  SWFDEC_AS_VALUE_SET_INT (&val, PANGO_ASCENT(ink_rect) / PANGO_SCALE);
+  SWFDEC_AS_VALUE_SET_INT (&val, ascent);
   swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_ascent, &val);
 
-  SWFDEC_AS_VALUE_SET_INT (&val, PANGO_DESCENT (ink_rect) / PANGO_SCALE);
+  SWFDEC_AS_VALUE_SET_INT (&val, descent);
   swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_descent, &val);
 
-  SWFDEC_AS_VALUE_SET_INT (&val, ink_rect.width / PANGO_SCALE +
-						   format->left_margin + format->right_margin + 4);
+  SWFDEC_AS_VALUE_SET_INT (&val, text_field_width);
   swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_textFieldWidth, &val);
 
-  SWFDEC_AS_VALUE_SET_INT (&val, ink_rect.height / PANGO_SCALE + 4 +
-						   format->leading);
+  SWFDEC_AS_VALUE_SET_INT (&val, text_field_height);
   swfdec_as_object_set_variable (obj, SWFDEC_AS_STR_textFieldHeight, &val);
 
   SWFDEC_AS_VALUE_SET_OBJECT (ret, obj);
diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 2350247..7091f46 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -965,6 +965,15 @@ EXTRA_DIST = \
 	empty-stack.as \
 	empty-stack.swf \
 	empty-stack.swf.trace \
+	empty-string-text-extent-5.swf \
+	empty-string-text-extent-5.swf.trace \
+	empty-string-text-extent-6.swf \
+	empty-string-text-extent-6.swf.trace \
+	empty-string-text-extent-7.swf \
+	empty-string-text-extent-7.swf.trace \
+	empty-string-text-extent-8.swf \
+	empty-string-text-extent-8.swf.trace \
+	empty-string-text-extent.as \
 	emptymovie-frames-bytes-5.swf \
 	emptymovie-frames-bytes-5.swf.trace \
 	emptymovie-frames-bytes-6.swf \
diff --git a/test/trace/empty-string-text-extent-5.swf b/test/trace/empty-string-text-extent-5.swf
new file mode 100644
index 0000000..eccfc51
Binary files /dev/null and b/test/trace/empty-string-text-extent-5.swf differ
diff --git a/test/trace/empty-string-text-extent-5.swf.trace b/test/trace/empty-string-text-extent-5.swf.trace
new file mode 100644
index 0000000..2cac76a
--- /dev/null
+++ b/test/trace/empty-string-text-extent-5.swf.trace
@@ -0,0 +1,3 @@
+Check if getTextExtent on an empty string returns 0 for width, height
+0
+0
diff --git a/test/trace/empty-string-text-extent-6.swf b/test/trace/empty-string-text-extent-6.swf
new file mode 100644
index 0000000..9d51f4f
Binary files /dev/null and b/test/trace/empty-string-text-extent-6.swf differ
diff --git a/test/trace/empty-string-text-extent-6.swf.trace b/test/trace/empty-string-text-extent-6.swf.trace
new file mode 100644
index 0000000..2cac76a
--- /dev/null
+++ b/test/trace/empty-string-text-extent-6.swf.trace
@@ -0,0 +1,3 @@
+Check if getTextExtent on an empty string returns 0 for width, height
+0
+0
diff --git a/test/trace/empty-string-text-extent-7.swf b/test/trace/empty-string-text-extent-7.swf
new file mode 100644
index 0000000..1f5ca02
Binary files /dev/null and b/test/trace/empty-string-text-extent-7.swf differ
diff --git a/test/trace/empty-string-text-extent-7.swf.trace b/test/trace/empty-string-text-extent-7.swf.trace
new file mode 100644
index 0000000..2cac76a
--- /dev/null
+++ b/test/trace/empty-string-text-extent-7.swf.trace
@@ -0,0 +1,3 @@
+Check if getTextExtent on an empty string returns 0 for width, height
+0
+0
diff --git a/test/trace/empty-string-text-extent-8.swf b/test/trace/empty-string-text-extent-8.swf
new file mode 100644
index 0000000..ddbf4ff
Binary files /dev/null and b/test/trace/empty-string-text-extent-8.swf differ
diff --git a/test/trace/empty-string-text-extent-8.swf.trace b/test/trace/empty-string-text-extent-8.swf.trace
new file mode 100644
index 0000000..2cac76a
--- /dev/null
+++ b/test/trace/empty-string-text-extent-8.swf.trace
@@ -0,0 +1,3 @@
+Check if getTextExtent on an empty string returns 0 for width, height
+0
+0
diff --git a/test/trace/empty-string-text-extent.as b/test/trace/empty-string-text-extent.as
new file mode 100644
index 0000000..70cdaea
--- /dev/null
+++ b/test/trace/empty-string-text-extent.as
@@ -0,0 +1,11 @@
+fmt = new TextFormat ();
+fmt.font = "_sans";
+fmt.size = 12;
+
+extent = fmt.getTextExtent ("");
+
+trace ("Check if getTextExtent on an empty string returns 0 for width, height");
+trace (extent.height);
+trace (extent.width);
+
+loadMovie ("FSCommand:quit", "");
commit 70462b139c9f1dd2e81014f3edaf6c799a6cc2b3
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 16:22:59 2008 +0200

    provide names for the action queues

diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index b5b0ba9..7f853c5 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -262,10 +262,10 @@ swfdec_actor_queue_script (SwfdecActor *actor, SwfdecEventType condition)
 
   switch (condition) {
     case SWFDEC_EVENT_INITIALIZE:
-      importance = 0;
+      importance = SWFDEC_PLAYER_ACTION_QUEUE_INIT;
       break;
     case SWFDEC_EVENT_CONSTRUCT:
-      importance = 1;
+      importance = SWFDEC_PLAYER_ACTION_QUEUE_CONSTRUCT;
       break;
     case SWFDEC_EVENT_LOAD:
     case SWFDEC_EVENT_ENTER:
@@ -284,11 +284,11 @@ swfdec_actor_queue_script (SwfdecActor *actor, SwfdecEventType condition)
     case SWFDEC_EVENT_DRAG_OVER:
     case SWFDEC_EVENT_DRAG_OUT:
     case SWFDEC_EVENT_KEY_PRESS:
-      importance = 2;
+      importance = SWFDEC_PLAYER_ACTION_QUEUE_NORMAL;
       break;
     case SWFDEC_EVENT_CHANGED:
     case SWFDEC_EVENT_SCROLL:
-      importance = 3;
+      importance = SWFDEC_PLAYER_ACTION_QUEUE_PRIORITY;
       break;
     default:
       g_return_if_reached ();
diff --git a/swfdec/swfdec_player_internal.h b/swfdec/swfdec_player_internal.h
index 5333e74..340c658 100644
--- a/swfdec/swfdec_player_internal.h
+++ b/swfdec/swfdec_player_internal.h
@@ -53,6 +53,10 @@ struct _SwfdecTimeout {
 };
 
 #define SWFDEC_PLAYER_N_ACTION_QUEUES 4
+#define SWFDEC_PLAYER_ACTION_QUEUE_INIT 0
+#define SWFDEC_PLAYER_ACTION_QUEUE_CONSTRUCT 1
+#define SWFDEC_PLAYER_ACTION_QUEUE_NORMAL 2
+#define SWFDEC_PLAYER_ACTION_QUEUE_PRIORITY 3
 
 struct _SwfdecPlayerPrivate
 {
diff --git a/swfdec/swfdec_resource.c b/swfdec/swfdec_resource.c
index 6ee756b..4316359 100644
--- a/swfdec/swfdec_resource.c
+++ b/swfdec/swfdec_resource.c
@@ -354,10 +354,8 @@ swfdec_resource_stream_target_close (SwfdecStreamTarget *target, SwfdecStream *s
   if (swfdec_resource_abort_if_not_initialized (resource))
     return;
 
-  if (resource->movie != NULL) {
-    swfdec_player_add_action (SWFDEC_PLAYER (SWFDEC_AS_OBJECT (resource)->context),
-	  SWFDEC_ACTOR (resource->movie), SWFDEC_EVENT_LOAD, 0);
-  }
+  if (resource->movie != NULL)
+    swfdec_actor_queue_script (SWFDEC_ACTOR (resource->movie), SWFDEC_EVENT_LOAD);
 }
 
 static void
diff --git a/swfdec/swfdec_sprite_movie.c b/swfdec/swfdec_sprite_movie.c
index d433884..34104dc 100644
--- a/swfdec/swfdec_sprite_movie.c
+++ b/swfdec/swfdec_sprite_movie.c
@@ -381,7 +381,8 @@ swfdec_sprite_movie_perform_one_action (SwfdecSpriteMovie *movie, guint tag, Swf
 	SwfdecScript *script = swfdec_swf_decoder_get_script (
 	    SWFDEC_SWF_DECODER (mov->resource->decoder), buffer->data);
 	if (script) {
-	  swfdec_player_add_action_script (player, actor, script, 2);
+	  swfdec_player_add_action_script (player, actor, script, 
+	      SWFDEC_PLAYER_ACTION_QUEUE_NORMAL);
 	} else {
 	  SWFDEC_ERROR ("Failed to locate script for DoAction tag");
 	}
@@ -473,7 +474,8 @@ swfdec_sprite_movie_perform_one_action (SwfdecSpriteMovie *movie, guint tag, Swf
 	sprite->init_action = swfdec_script_ref (swfdec_swf_decoder_get_script (
 	    SWFDEC_SWF_DECODER (mov->resource->decoder), buffer->data + 2));
 	if (sprite->init_action) {
-	  swfdec_player_add_action_script (player, actor, sprite->init_action, 0);
+	  swfdec_player_add_action_script (player, actor, sprite->init_action, 
+	      SWFDEC_PLAYER_ACTION_QUEUE_INIT);
 	} else {
 	  SWFDEC_ERROR ("Failed to locate script for InitAction of Sprite %u", id);
 	}
@@ -663,7 +665,6 @@ static void
 swfdec_sprite_movie_iterate (SwfdecActor *actor)
 {
   SwfdecSpriteMovie *movie = SWFDEC_SPRITE_MOVIE (actor);
-  SwfdecPlayer *player = SWFDEC_PLAYER (SWFDEC_AS_OBJECT (actor)->context);
   guint goto_frame;
 
   if (SWFDEC_MOVIE (actor)->state >= SWFDEC_MOVIE_STATE_REMOVED)
@@ -672,7 +673,7 @@ swfdec_sprite_movie_iterate (SwfdecActor *actor)
   if (movie->sprite && movie->frame == (guint) -1)
     movie->frame = 0;
 
-  swfdec_player_add_action (player, actor, SWFDEC_EVENT_ENTER, 2);
+  swfdec_actor_queue_script (actor, SWFDEC_EVENT_ENTER);
   if (movie->playing && movie->sprite != NULL) {
     if (movie->frame == movie->n_frames)
       goto_frame = 1;
commit a576afa723cf36d21e3610b34cc5924e1cb4ac3c
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 10:58:47 2008 +0200

    add test for just-fixed crasher

diff --git a/test/trace/Makefile.am b/test/trace/Makefile.am
index 6774551..2350247 100644
--- a/test/trace/Makefile.am
+++ b/test/trace/Makefile.am
@@ -758,6 +758,15 @@ EXTRA_DIST = \
 	crash-0.6.2-replaceText-8.swf \
 	crash-0.6.2-replaceText-8.swf.trace \
 	crash-0.6.2-replaceText.as \
+	crash-0.6.2-try-and-exception-on-dispose-5.swf \
+	crash-0.6.2-try-and-exception-on-dispose-5.swf.trace \
+	crash-0.6.2-try-and-exception-on-dispose-6.swf \
+	crash-0.6.2-try-and-exception-on-dispose-6.swf.trace \
+	crash-0.6.2-try-and-exception-on-dispose-7.swf \
+	crash-0.6.2-try-and-exception-on-dispose-7.swf.trace \
+	crash-0.6.2-try-and-exception-on-dispose-8.swf \
+	crash-0.6.2-try-and-exception-on-dispose-8.swf.trace \
+	crash-0.6.2-try-and-exception-on-dispose.as \
 	currentframe.swf \
 	currentframe.swf.trace \
 	dangling-compare.as \
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-5.swf b/test/trace/crash-0.6.2-try-and-exception-on-dispose-5.swf
new file mode 100644
index 0000000..e98c9fe
Binary files /dev/null and b/test/trace/crash-0.6.2-try-and-exception-on-dispose-5.swf differ
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-5.swf.trace b/test/trace/crash-0.6.2-try-and-exception-on-dispose-5.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-6.swf b/test/trace/crash-0.6.2-try-and-exception-on-dispose-6.swf
new file mode 100644
index 0000000..ba6bd21
Binary files /dev/null and b/test/trace/crash-0.6.2-try-and-exception-on-dispose-6.swf differ
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-6.swf.trace b/test/trace/crash-0.6.2-try-and-exception-on-dispose-6.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-7.swf b/test/trace/crash-0.6.2-try-and-exception-on-dispose-7.swf
new file mode 100644
index 0000000..788a1f5
Binary files /dev/null and b/test/trace/crash-0.6.2-try-and-exception-on-dispose-7.swf differ
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-7.swf.trace b/test/trace/crash-0.6.2-try-and-exception-on-dispose-7.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-8.swf b/test/trace/crash-0.6.2-try-and-exception-on-dispose-8.swf
new file mode 100644
index 0000000..8695f70
Binary files /dev/null and b/test/trace/crash-0.6.2-try-and-exception-on-dispose-8.swf differ
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose-8.swf.trace b/test/trace/crash-0.6.2-try-and-exception-on-dispose-8.swf.trace
new file mode 100644
index 0000000..e69de29
diff --git a/test/trace/crash-0.6.2-try-and-exception-on-dispose.as b/test/trace/crash-0.6.2-try-and-exception-on-dispose.as
new file mode 100644
index 0000000..42f4083
--- /dev/null
+++ b/test/trace/crash-0.6.2-try-and-exception-on-dispose.as
@@ -0,0 +1,14 @@
+// makeswf -v 7 -s 200x150 -r 1 -o crash-0.6.2-try-and-exception-on-dispose.swf crash-0.6.2-try-and-exception-on-dispose.as
+
+getURL ("fscommand:quit", "");
+
+function boom () {
+  try {
+    return;
+    trace ("hi");
+  } catch (e) {
+  };
+};
+
+boom ();
+throw ("hi");
commit 56a90a70574b346f7d3389d69e5f797542a89d6d
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 10:56:16 2008 +0200

    fix SEGV when collecting frames that are in a try block
    
    ... while the context is in an exception state

diff --git a/swfdec/swfdec_as_context.c b/swfdec/swfdec_as_context.c
index 0d0bef3..8c637a3 100644
--- a/swfdec/swfdec_as_context.c
+++ b/swfdec/swfdec_as_context.c
@@ -533,6 +533,9 @@ swfdec_as_context_dispose (GObject *object)
 
   while (context->stack)
     swfdec_as_stack_pop_segment (context);
+  /* We need to make sure there's no exception here. Otherwise collecting 
+   * frames that are inside a try block will assert */
+  swfdec_as_context_catch (context, NULL);
   swfdec_as_context_collect (context);
   if (context->memory != 0) {
     g_critical ("%zu bytes of memory left over\n", context->memory);
commit bbbe6e577396332219f17d53ebfbb797e3879ac6
Author: Benjamin Otte <otte at gnome.org>
Date:   Fri Apr 4 10:50:49 2008 +0200

    introduce TextField signals onScroller and onChanged as normal actions

diff --git a/swfdec/swfdec_actor.c b/swfdec/swfdec_actor.c
index a30cfd7..b5b0ba9 100644
--- a/swfdec/swfdec_actor.c
+++ b/swfdec/swfdec_actor.c
@@ -286,6 +286,10 @@ swfdec_actor_queue_script (SwfdecActor *actor, SwfdecEventType condition)
     case SWFDEC_EVENT_KEY_PRESS:
       importance = 2;
       break;
+    case SWFDEC_EVENT_CHANGED:
+    case SWFDEC_EVENT_SCROLL:
+      importance = 3;
+      break;
     default:
       g_return_if_reached ();
   }
diff --git a/swfdec/swfdec_as_strings.c b/swfdec/swfdec_as_strings.c
index 8d87b2e..b7bf838 100644
--- a/swfdec/swfdec_as_strings.c
+++ b/swfdec/swfdec_as_strings.c
@@ -502,5 +502,6 @@ const char swfdec_as_strings[] =
   SWFDEC_AS_CONSTANT_STRING ("textFieldWidth")
   SWFDEC_AS_CONSTANT_STRING ("tabChildren")
   SWFDEC_AS_CONSTANT_STRING ("tabIndex")
+  SWFDEC_AS_CONSTANT_STRING ("onChanged")
   /* add more here */
 ;
diff --git a/swfdec/swfdec_event.c b/swfdec/swfdec_event.c
index 6af665d..876390e 100644
--- a/swfdec/swfdec_event.c
+++ b/swfdec/swfdec_event.c
@@ -92,6 +92,10 @@ swfdec_event_type_get_name (SwfdecEventType type)
       return NULL;
     case SWFDEC_EVENT_CONSTRUCT:
       return SWFDEC_AS_STR_onConstruct;
+    case SWFDEC_EVENT_CHANGED:
+      return SWFDEC_AS_STR_onChanged;
+    case SWFDEC_EVENT_SCROLL:
+      return SWFDEC_AS_STR_onScroller;
     default:
       g_assert_not_reached ();
       return NULL;
@@ -158,7 +162,7 @@ swfdec_event_list_parse (SwfdecEventList *list, SwfdecBits *bits, int version,
   g_return_if_fail (list->refcount == 1);
   g_return_if_fail (description != NULL);
 
-  event.conditions = conditions;
+  event.conditions = conditions & SWFDEC_EVENT_MASK;
   event.key = key;
   i = g_bit_nth_lsf (conditions, -1);
   name = g_strconcat (description, ".", i < N_CONDITIONS ? 
diff --git a/swfdec/swfdec_event.h b/swfdec/swfdec_event.h
index ed13327..0f04461 100644
--- a/swfdec/swfdec_event.h
+++ b/swfdec/swfdec_event.h
@@ -46,9 +46,14 @@ typedef enum _SwfdecEventType {
   SWFDEC_EVENT_DRAG_OVER = 15,
   SWFDEC_EVENT_DRAG_OUT = 16,
   SWFDEC_EVENT_KEY_PRESS = 17,
-  SWFDEC_EVENT_CONSTRUCT = 18
+  SWFDEC_EVENT_CONSTRUCT = 18,
+  /* non-loadable events go here */
+  SWFDEC_EVENT_CHANGED = 19,
+  SWFDEC_EVENT_SCROLL = 20,
 } SwfdecEventType;
 
+#define SWFDEC_EVENT_MASK ((1 << SWFDEC_EVENT_CONSTRUCT) - 1)
+
 const char *		swfdec_event_type_get_name	(SwfdecEventType      type);
 
 SwfdecEventList *	swfdec_event_list_new		(SwfdecPlayer *	      player);


More information about the Swfdec-commits mailing list