CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/13 15:41:49
Modified files: . : ChangeLog server : button_character_instance.cpp button_character_instance.h movie_root.cpp Log message: * server/button_character_instance.{cpp,h}: implement unload() in an attempt to properly mark as unloaded any character registered in the global instance list (could happen for child sprites). * server/movie_root.cpp (markReachableResources): mark all characters in the _liveChars. This makes Gnash more robust, but hides a problem with the global instance list always growing. A proper fix would be making sure that for *all* characters removed from a displaylist the character::unload() is called, which marks the character as unloaded and thus removes it from the global instance list. The change above to button_character_instance seems not enough. I left debugging output here so you can see how the list keeps growing. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4304&r2=1.4305 http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.55&r2=1.56 http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.h?cvsroot=gnash&r1=1.23&r2=1.24 http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.89&r2=1.90 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4304 retrieving revision 1.4305 diff -u -b -r1.4304 -r1.4305 --- ChangeLog 13 Sep 2007 14:39:21 -0000 1.4304 +++ ChangeLog 13 Sep 2007 15:41:49 -0000 1.4305 @@ -1,5 +1,20 @@ 2007-09-13 Sandro Santilli <[EMAIL PROTECTED]> + * server/button_character_instance.{cpp,h}: implement unload() in an + attempt to properly mark as unloaded any character registered in the + global instance list (could happen for child sprites). + * server/movie_root.cpp (markReachableResources): mark all characters + in the _liveChars. This makes Gnash more robust, but hides a problem + with the global instance list always growing. A proper fix would be + making sure that for *all* characters removed from a displaylist the + character::unload() is called, which marks the character as unloaded + and thus removes it from the global instance list. The change above + to button_character_instance seems not enough. I left debugging + output here so you can see how the list keeps growing. + + +2007-09-13 Sandro Santilli <[EMAIL PROTECTED]> + * server/movie_root.{cpp,h} (restart): properly cleanup action queue and instances list, reset levels so that only _level0 is kept. Still not 100% correct but fixes Index: server/button_character_instance.cpp =================================================================== RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v retrieving revision 1.55 retrieving revision 1.56 diff -u -b -r1.55 -r1.56 --- server/button_character_instance.cpp 13 Sep 2007 13:57:49 -0000 1.55 +++ server/button_character_instance.cpp 13 Sep 2007 15:41:49 -0000 1.56 @@ -913,6 +913,25 @@ } #endif // GNASH_USE_GC +bool +button_character_instance::unload() +{ + bool childsHaveUnload = false; + + // We need to unload all childs, or the global instance list will keep growing forever ! + //std::for_each(m_record_character.begin(), m_record_character.end(), boost::bind(&character::unload, _1)); + for (CharsVect::iterator i=m_record_character.begin(), e=m_record_character.end(); i!=e; ++i) + { + boost::intrusive_ptr<character> ch = *i; + if ( ch->unload() ) childsHaveUnload = true; + //log_debug("Button child %s (%s) unloaded", ch->getTarget().c_str(), typeName(*ch).c_str()); + } + + bool hasUnloadEvent = character::unload(); + + return hasUnloadEvent || childsHaveUnload; +} + } // end of namespace gnash Index: server/button_character_instance.h =================================================================== RCS file: /sources/gnash/gnash/server/button_character_instance.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- server/button_character_instance.h 1 Jul 2007 10:54:21 -0000 1.23 +++ server/button_character_instance.h 13 Sep 2007 15:41:49 -0000 1.24 @@ -21,7 +21,7 @@ // SWF buttons. Mouse-sensitive update/display, actions, etc. -/* $Id: button_character_instance.h,v 1.23 2007/07/01 10:54:21 bjacques Exp $ */ +/* $Id: button_character_instance.h,v 1.24 2007/09/13 15:41:49 strk Exp $ */ #ifndef GNASH_BUTTON_CHARACTER_INSTANCE_H #define GNASH_BUTTON_CHARACTER_INSTANCE_H @@ -151,6 +151,9 @@ /// Properly initialize instance names for contained sprites virtual void construct(); + /// Properly unload contained characters + bool unload(); + protected: #ifdef GNASH_USE_GC Index: server/movie_root.cpp =================================================================== RCS file: /sources/gnash/gnash/server/movie_root.cpp,v retrieving revision 1.89 retrieving revision 1.90 diff -u -b -r1.89 -r1.90 --- server/movie_root.cpp 13 Sep 2007 14:39:21 -0000 1.89 +++ server/movie_root.cpp 13 Sep 2007 15:41:49 -0000 1.90 @@ -1222,6 +1222,22 @@ // will be also marked as reachable by scanning the // DisplayList... // + // Well, playing SimGirl.swf and hanging out with cheeks triggers + // exactly this problem, one of the registered live movies are not marked + // Dunno exactly why, since none of them should be marked as unloaded, thus + // reachable somewhere... anyway let's do it + // + // WARNING: this list will keeps growing, as we don't properly unload() + // all characters... + // + log_debug("Marking %d live chars", _liveChars.size()); + for (LiveChars::const_iterator i=_liveChars.begin(), e=_liveChars.end(); + i != e; ++i) + { + (*i)->setReachable(); + } + + } #endif // GNASH_USE_GC _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit