gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/dlist.cpp server/dlist.h...
Date: Wed, 05 Sep 2007 09:47:56 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/09/05 09:47:56

Modified files:
        .              : ChangeLog 
        server         : dlist.cpp dlist.h sprite_instance.cpp 
        testsuite/misc-swfc.all: movieclip_destruction_test4.sc 

Log message:
                * server/dlist.{cpp,h}: add ::unload method for taking
                  care of unloads triggered by parent unload.
                * server/sprite_instance.cpp (unload): use DisplayList::unload
                * testsuite/misc-swfc.all/movieclip_destruction_test4.sc: fix
                  destruction of childs w/out onUnload event handler defined.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4228&r2=1.4229
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.85&r2=1.86
http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.h?cvsroot=gnash&r1=1.48&r2=1.49
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.326&r2=1.327
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/misc-swfc.all/movieclip_destruction_test4.sc?cvsroot=gnash&r1=1.2&r2=1.3

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4228
retrieving revision 1.4229
diff -u -b -r1.4228 -r1.4229
--- ChangeLog   5 Sep 2007 06:13:27 -0000       1.4228
+++ ChangeLog   5 Sep 2007 09:47:55 -0000       1.4229
@@ -1,3 +1,11 @@
+2007-09-05 Sandro Santilli <address@hidden>
+
+       * server/dlist.{cpp,h}: add ::unload method for taking
+         care of unloads triggered by parent unload.
+       * server/sprite_instance.cpp (unload): use DisplayList::unload
+       * testsuite/misc-swfc.all/movieclip_destruction_test4.sc: fix
+         destruction of childs w/out onUnload event handler defined.
+
 2007-09-05 Zou Lunkai <address@hidden>
 
        * testsuite/misc-swfc.all/movieclip_destruction_test1.sc: more tests 
about 

Index: server/dlist.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- server/dlist.cpp    4 Sep 2007 08:23:19 -0000       1.85
+++ server/dlist.cpp    5 Sep 2007 09:47:55 -0000       1.86
@@ -801,6 +801,34 @@
        testInvariant();
 }
        
+bool
+DisplayList::unload()
+{
+       //GNASH_REPORT_FUNCTION;
+
+       testInvariant();
+
+       for (iterator it = _characters.begin(), itEnd = _characters.end(); it 
!= itEnd; )
+       {
+               // make a copy
+               DisplayItem di = *it;
+
+               if ( ! di->unload() ) // no event handler queued, we remove
+               {
+                       it = _characters.erase(it);
+               }
+               else
+               {
+                       ++it;
+               }
+       }
+
+       testInvariant();
+
+       return ! _characters.empty();
+
+}
+       
 void
 DisplayList::advance(float delta_time)
 // advance referenced characters.

Index: server/dlist.h
===================================================================
RCS file: /sources/gnash/gnash/server/dlist.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- server/dlist.h      1 Sep 2007 01:20:46 -0000       1.48
+++ server/dlist.h      5 Sep 2007 09:47:55 -0000       1.49
@@ -214,6 +214,15 @@
                _characters.clear();
        }
 
+       /// Unload the characters in this DisplayList removing
+       /// all but the ones with on onUnload event defined
+       /// (checked by calling ::unload on them) and keeping
+       /// the others, w/out depth-shifting them.
+       ///
+       /// Return true if any child was kept (as they had onUnload defined)
+       ///
+       bool unload();
+
        /// \brief
        /// Clear all characters in this DisplayList that are also found
        /// in the given DisplayList

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.326
retrieving revision 1.327
diff -u -b -r1.326 -r1.327
--- server/sprite_instance.cpp  4 Sep 2007 22:59:29 -0000       1.326
+++ server/sprite_instance.cpp  5 Sep 2007 09:47:55 -0000       1.327
@@ -1676,30 +1676,6 @@
        }
 };
 
-/// A DisplayList visitor used to unload all characters
-class UnloaderVisitor {
-       int unloadEvents;
-
-public:
-       UnloaderVisitor()
-               :
-               unloadEvents(0)
-       {}
-
-       void operator() (character* ch)
-       {
-               // don't unload already unloaded characters
-               if ( ch->isUnloaded() ) return;
-
-               if ( ch->unload() ) ++unloadEvents;
-       }
-
-       bool foundUnloadEvents() const 
-       {
-               return unloadEvents != 0;
-       }
-};
-
 /// A DisplayList visitor used to advance all non-unloaded characters
 class AdvancerVisitor {
 
@@ -3422,10 +3398,9 @@
        log_msg(_("Unloading sprite '%s'"), getTargetPath().c_str());
 #endif
 
-       UnloaderVisitor visitor;
-       m_display_list.visitAll(visitor);
+       bool childHaveUnloadHandler = m_display_list.unload();
 
-       return character::unload() || visitor.foundUnloadEvents();
+       return character::unload() || childHaveUnloadHandler;
 
 }
 

Index: testsuite/misc-swfc.all/movieclip_destruction_test4.sc
===================================================================
RCS file: 
/sources/gnash/gnash/testsuite/misc-swfc.all/movieclip_destruction_test4.sc,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- testsuite/misc-swfc.all/movieclip_destruction_test4.sc      5 Sep 2007 
06:13:28 -0000       1.2
+++ testsuite/misc-swfc.all/movieclip_destruction_test4.sc      5 Sep 2007 
09:47:56 -0000       1.3
@@ -102,7 +102,7 @@
       _root.check_equals(this.getDepth(), -32809);
       // child mc31 has no onUnload defined. child mc31 has been destroyed.
       // Gnash fails by keeping the child alive(referenceable)
-      _root.xcheck_equals(typeof(this.mc31), 'undefined');
+      _root.check_equals(typeof(this.mc31), 'undefined');
     };
     
     // Define child onUnload




reply via email to

[Prev in Thread] Current Thread [Next in Thread]