CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/27 15:02:06

Modified files:
        .              : ChangeLog 
        server         : sprite_instance.cpp sprite_instance.h 

Log message:
                * server/sprite_instance.{cpp,h}: add isUnloaded()
                  method to properly skip execution of queued
                  actions for unloaded sprites.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2691&r2=1.2692
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.202&r2=1.203
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.78&r2=1.79

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2691
retrieving revision 1.2692
diff -u -b -r1.2691 -r1.2692
--- ChangeLog   27 Mar 2007 14:52:04 -0000      1.2691
+++ ChangeLog   27 Mar 2007 15:02:06 -0000      1.2692
@@ -1,5 +1,8 @@
 2007-03-27 Sandro Santilli <[EMAIL PROTECTED]>
 
+       * server/sprite_instance.{cpp,h}: add isUnloaded()
+         method to properly skip execution of queued
+         actions for unloaded sprites.
        * server/vm/: Makefile.am, ExecutableCode.h:
          Add definition of a generic Executable Code
          for use as element of the global Action Queue.

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.202
retrieving revision 1.203
diff -u -b -r1.202 -r1.203
--- server/sprite_instance.cpp  25 Mar 2007 15:20:56 -0000      1.202
+++ server/sprite_instance.cpp  27 Mar 2007 15:02:06 -0000      1.203
@@ -2141,6 +2141,58 @@
        }
 }
 
+void
+sprite_instance::queueEventHandler(const event_id& id)
+{
+       testInvariant();
+
+       bool called=false;
+
+       movie_root& root = VM::get().getRoot();
+
+       // First, check for built-in event handler.
+       boost::intrusive_ptr<as_function> method = 
get_event_handler(id).to_as_function();
+          
+       if (method)
+       {
+               root.pushAction(method, 
boost::intrusive_ptr<sprite_instance>(this));
+               called=true;
+       }
+
+       // This is likely wrong, we use it as a workaround
+       // to the fact that we don't distinguish between
+       // ActionScript and SWF defined events
+       // (for example: onClipLoad vs. onLoad)
+       //
+       if (called) return;
+
+       // Check for member function.
+       // In ActionScript 2.0, event method names are CASE SENSITIVE.
+       // In ActionScript 1.0, event method names are CASE INSENSITIVE.
+       // TODO: move to get_function_name directly ?
+       std::string method_name = id.get_function_name();
+       if ( _vm.getSWFVersion() < 7 )
+       {
+               boost::to_lower(method_name, _vm.getLocale());
+       }
+
+       if (method_name.length() > 0)
+       {
+               as_value method_val;
+               if ( get_member(method_name, &method_val) )
+               {
+                       method = method_val.to_as_function();
+                       if ( method )
+                       {
+                               root.pushAction(method, 
boost::intrusive_ptr<sprite_instance>(this));
+                       }
+               }
+       }
+
+       testInvariant();
+
+}
+
 bool
 sprite_instance::on_event(const event_id& id)
 {

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- server/sprite_instance.h    20 Mar 2007 15:01:20 -0000      1.78
+++ server/sprite_instance.h    27 Mar 2007 15:02:06 -0000      1.79
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: sprite_instance.h,v 1.78 2007/03/20 15:01:20 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.79 2007/03/27 15:02:06 strk Exp $ */
 
 // Stateful live Sprite instance
 
@@ -681,8 +681,17 @@
 
        /// @} Drawing API
 
+
+       bool isUnloaded() { return _unloaded; }
+
 private:
 
+       /// Queue event handler(s), if any.
+       void queueEventHandler(const event_id& id);
+
+       /// Set to yes when this instance has been unloaded
+       bool _unloaded;
+
        /// Execute a single action buffer (DOACTION block)
        void execute_action(action_buffer& ab);
 


_______________________________________________
Gnash-commit mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/gnash-commit

Reply via email to