gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/movie_root.cpp


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/movie_root.cpp
Date: Fri, 14 Mar 2008 11:25:42 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  08/03/14 11:25:42

Modified files:
        .              : ChangeLog 
        server         : movie_root.cpp 

Log message:
        (cleanDisplayList): make sure NO unloaded characters are in the live
        instances container after a call to this method.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5908&r2=1.5909
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.167&r2=1.168

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5908
retrieving revision 1.5909
diff -u -b -r1.5908 -r1.5909
--- ChangeLog   14 Mar 2008 08:19:52 -0000      1.5908
+++ ChangeLog   14 Mar 2008 11:25:41 -0000      1.5909
@@ -1,5 +1,8 @@
 2008-03-14 Sandro Santilli <address@hidden>
 
+       * server/movie_root.cpp (cleanDisplayList): make sure NO unloaded
+         characters are in the live instances container after a call to
+         this method.
        * testsuite/actionscript.all/Inheritance.as: test gaps in the
          inheritance chain. Gnash fails for SWF>6.
 

Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -b -r1.167 -r1.168
--- server/movie_root.cpp       12 Mar 2008 16:04:05 -0000      1.167
+++ server/movie_root.cpp       14 Mar 2008 11:25:41 -0000      1.168
@@ -1571,14 +1571,6 @@
         }
     }
 
-    // NOTE: cleanupUnloadedListeners should have cleaned up all unloaded key 
listeners 
-    //       the remaining ones should be marked by their parents
-    //std::for_each(m_key_listeners.begin(), m_key_listeners.end(), 
boost::bind(&character::setReachable, _1));
-
-    // NOTE: cleanupUnloadedListeners should have cleaned up all unloaded 
mouse listeners 
-    //       the remaining ones should be marked by their parents
-    //std::for_each(m_mouse_listeners.begin(), m_mouse_listeners.end(), 
boost::bind(&character::setReachable, _1));
-
     // Mark global Key object
     if ( _keyobject ) _keyobject->setReachable();
 
@@ -1593,6 +1585,14 @@
     //       parent.
     //std::for_each(_liveChars.begin(), _liveChars.end(), 
boost::bind(&character::setReachable, _1));
     
+    // NOTE: cleanupUnloadedListeners should have cleaned up all unloaded key 
listeners 
+    //       the remaining ones should be marked by their parents
+    //std::for_each(m_key_listeners.begin(), m_key_listeners.end(), 
boost::bind(&character::setReachable, _1));
+
+    // NOTE: cleanupUnloadedListeners should have cleaned up all unloaded 
mouse listeners 
+    //       the remaining ones should be marked by their parents
+    //std::for_each(m_mouse_listeners.begin(), m_mouse_listeners.end(), 
boost::bind(&character::setReachable, _1));
+
 }
 #endif // GNASH_USE_GC
 
@@ -1629,6 +1629,47 @@
        static size_t maxLiveChars = 0;
 #endif
 
+       // Let every sprite cleanup the local DisplayList
+        //
+        // TODO: we might skip this additinal scan by delegating
+        //       cleanup of the local DisplayLists in the ::display
+        //       method of each sprite, but that will introduce 
+        //       problems when we'll implement skipping ::display()
+        //       when late on FPS. Alternatively we may have the
+        //       sprite_instance::markReachableResources take care
+        //       of cleaning up unloaded... but that will likely
+        //       introduce problems when allowing the GC to run
+        //       at arbitrary times.
+        //       The invariant to keep is that cleanup of unloaded characters
+        //       in local display lists must happen at the *end* of global 
action
+        //       queue processing.
+        //
+        for (Levels::reverse_iterator i=_movies.rbegin(), e=_movies.rend(); 
i!=e; ++i)
+        {
+                i->second->cleanupDisplayList();
+        }
+
+       // Now remove from the instance list any unloaded character
+       // Note that some characters may be unloaded but not yet destroyed,
+       // in this case we'll also destroy them, which in turn might unload
+       // further characters, maybe already scanned, so we keep scanning
+       // the list until no more unloaded-but-non-destroyed characters
+       // are found.
+       // Keeping unloaded-but-non-destroyed characters wouldn't really hurt
+       // in that ::advanceLiveChars would skip any unloaded characters.
+       // Still, the more we remove the less work GC has to do...
+       //
+
+       bool needScan;
+#ifdef GNASH_DEBUG_DLIST_CLEANUP
+       int scansCount = 0;
+#endif
+       do {
+#ifdef GNASH_DEBUG_DLIST_CLEANUP
+               scansCount++;
+               int cleaned =0;
+#endif
+               needScan=false;
        // Remove unloaded characters from the _liveChars list
        for (LiveChars::iterator i=_liveChars.begin(), e=_liveChars.end(); 
i!=e;)
        {
@@ -1639,14 +1680,36 @@
                        // by effect of an unload() call with no onUnload
                        // handlers available either in self or child
                        // characters
-                       if ( ! ch->isDestroyed() ) ch->destroy();
+                               if ( ! ch->isDestroyed() )
+                               {
+#ifdef GNASH_DEBUG_DLIST_CLEANUP
+                                       cout << ch->getTarget() << "(" << 
typeName(*ch) << ") was unloaded but not destroyed, destroying now" << endl;
+#endif
+                                       ch->destroy();
+                                       needScan=true; // ->destroy() might 
mark already-scanned chars as unloaded
+                               }
+#ifdef GNASH_DEBUG_DLIST_CLEANUP
+                               else
+                               {
+                                       cout << ch->getTarget() << "(" << 
typeName(*ch) << ") was unloaded and destroyed" << endl;
+                               }
+#endif
+
                        i = _liveChars.erase(i);
+
+#ifdef GNASH_DEBUG_DLIST_CLEANUP
+                               cleaned++;
+#endif
                }
                else
                {
                        ++i;
                }
        }
+#ifdef GNASH_DEBUG_DLIST_CLEANUP
+               cout << " Scan " << scansCount << " cleaned " << cleaned << " 
instances" << endl;
+#endif
+       } while (needScan);
 
 #ifdef GNASH_DEBUG_INSTANCE_LIST
        if ( _liveChars.size() > maxLiveChars )
@@ -1656,25 +1719,6 @@
        }
 #endif
 
-       // Let every sprite cleanup the local DisplayList
-        //
-        // TODO: we might skip this additinal scan by delegating
-        //       cleanup of the local DisplayLists in the ::display
-        //       method of each sprite, but that will introduce 
-        //       problems when we'll implement skipping ::display()
-        //       when late on FPS. Alternatively we may have the
-        //       sprite_instance::markReachableResources take care
-        //       of cleaning up unloaded... but that will likely
-        //       introduce problems when allowing the GC to run
-        //       at arbitrary times.
-        //       The invariant to keep is that cleanup of unloaded characters
-        //       in local display lists must happen at the *end* of global 
action
-        //       queue processing.
-        //
-        for (Levels::reverse_iterator i=_movies.rbegin(), e=_movies.rend(); 
i!=e; ++i)
-        {
-                i->second->cleanupDisplayList();
-        }
 }
 
 /*static private*/




reply via email to

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