CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/09/03 17:37:38
Modified files: . : ChangeLog server : character.cpp dlist.cpp Log message: * server/character.cpp (unload): call queueEventHandler before setting _unloaded to true. * server/dlist.cpp (wherever characters are unloaded): call unload() after removing the character. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4202&r2=1.4203 http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.51&r2=1.52 http://cvs.savannah.gnu.org/viewcvs/gnash/server/dlist.cpp?cvsroot=gnash&r1=1.83&r2=1.84 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4202 retrieving revision 1.4203 diff -u -b -r1.4202 -r1.4203 --- ChangeLog 3 Sep 2007 16:50:08 -0000 1.4202 +++ ChangeLog 3 Sep 2007 17:37:37 -0000 1.4203 @@ -1,3 +1,10 @@ +2007-09-03 Sandro Santilli <[EMAIL PROTECTED]> + + * server/character.cpp (unload): call queueEventHandler before setting + _unloaded to true. + * server/dlist.cpp (wherever characters are unloaded): call unload() after + removing the character. + 2007-09-04 Chad Musick <[EMAIL PROTECTED]> * server/font.cpp,.h: Add is_subpixel_font flag for DefineFont3 tag. Index: server/character.cpp =================================================================== RCS file: /sources/gnash/gnash/server/character.cpp,v retrieving revision 1.51 retrieving revision 1.52 diff -u -b -r1.51 -r1.52 --- server/character.cpp 1 Sep 2007 01:20:46 -0000 1.51 +++ server/character.cpp 3 Sep 2007 17:37:37 -0000 1.52 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: character.cpp,v 1.51 2007/09/01 01:20:46 strk Exp $ */ +/* $Id: character.cpp,v 1.52 2007/09/03 17:37:37 strk Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -677,11 +677,14 @@ character::unload() { assert(!_unloaded); // don't unload characters twice ! - _unloaded = true; //log_msg(_("Queuing unload event for character %p"), this); - return queueEventHandler(event_id::UNLOAD); + bool hasEvent = queueEventHandler(event_id::UNLOAD); //on_event(event_id::UNLOAD); + + _unloaded = true; + + return hasEvent; } bool Index: server/dlist.cpp =================================================================== RCS file: /sources/gnash/gnash/server/dlist.cpp,v retrieving revision 1.83 retrieving revision 1.84 diff -u -b -r1.83 -r1.84 --- server/dlist.cpp 3 Sep 2007 10:48:34 -0000 1.83 +++ server/dlist.cpp 3 Sep 2007 17:37:37 -0000 1.84 @@ -218,14 +218,17 @@ InvalidatedRanges old_ranges; (*it)->add_invalidated_bounds(old_ranges, true); + // make a copy (before replacing) boost::intrusive_ptr<character> oldCh = *it; - bool hasUnloadEvent = oldCh->unload(); - // replace existing char + // replace existing char (before calling unload!) *it = DisplayItem(ch); + if ( oldCh->unload() ) + { // reinsert removed character if needed - if ( hasUnloadEvent ) reinsertRemovedCharacter(oldCh); + reinsertRemovedCharacter(oldCh); + } // extend invalidated bounds ch->extend_invalidated_bounds(old_ranges); @@ -323,6 +326,7 @@ } else { + // Make a copy (before replacing) boost::intrusive_ptr<character> oldch = *it; InvalidatedRanges old_ranges; @@ -342,14 +346,15 @@ // remember bounds of old char oldch->add_invalidated_bounds(old_ranges, true); - // Unload old char - bool hasUnloadEvent = oldch->unload(); - - // replace existing char + // replace existing char (before calling unload) *it = di; + // Unload old char + if ( oldch->unload() ) + { // reinsert removed character if needed - if ( hasUnloadEvent ) reinsertRemovedCharacter(oldch); + reinsertRemovedCharacter(oldch); + } // extend invalidated bounds // WARNING: when a new Button character is added, @@ -452,17 +457,21 @@ if ( it != _characters.end() ) { + // Make a copy (before erasing) boost::intrusive_ptr<character> oldCh = *it; - bool hasUnloadEvent = oldCh->unload(); + // Erase (before callign unload) _characters.erase(it); + if ( oldCh->unload() ) + { // reinsert removed character if needed // NOTE: could be optimized if we knew exactly how // to handle the case in which the target depth // (after the shift) is occupied already // - if ( hasUnloadEvent ) reinsertRemovedCharacter(oldCh); + reinsertRemovedCharacter(oldCh); + } } #ifndef NDEBUG @@ -587,7 +596,8 @@ { testInvariant(); - DisplayItem& di = *it; + // Make a copy here, in case we're going to replace it + DisplayItem di = *it; int di_depth = di->get_depth(); @@ -601,7 +611,9 @@ //if ( di->isDynamic() ) if ( ! info ) { - // Not to be saved, killing + // Replace (before calling unload) + it = _characters.erase(it); + if ( call_unload ) { if ( di->unload() ) @@ -609,7 +621,7 @@ toReinsert.push_back(di); } } - it = _characters.erase(it); + continue; } @@ -631,6 +643,10 @@ if( match == save.end()) { // Not to be saved, killing + + // Replace (before calling unload) + it = _characters.erase(it); + if ( call_unload ) { if ( di->unload() ) @@ -638,7 +654,7 @@ toReinsert.push_back(di); } } - it = _characters.erase(it); + continue; } @@ -686,7 +702,8 @@ testInvariant(); // TODO: expensive //log_debug("Invariant test in iteration %d worked", called++); - DisplayItem& di = *it; + // make a copy of the pointer here, don't take a reference + DisplayItem di = *it; bool is_affected = false; for (const_iterator kit = keepStart; kit != keepEnd; ++kit) @@ -700,6 +717,10 @@ if (is_affected == false) { + bool needReinsert = false; + + it = _characters.erase(it); + if ( call_unload ) { if ( di->unload() ) @@ -707,7 +728,7 @@ toReinsert.push_back(di); } } - it = _characters.erase(it); + continue; } it++; @@ -736,7 +757,8 @@ for (iterator it = _characters.begin(), itEnd = _characters.end(); it != itEnd; ) { - DisplayItem& di = *it; + // make a copy + DisplayItem di = *it; bool is_affected = false; for (const_iterator kit = dropchars.begin(), kitEnd = dropchars.end(); kit != kitEnd; ++kit) @@ -750,6 +772,8 @@ if (is_affected) { + it = _characters.erase(it); + if ( call_unload ) { if ( di->unload() ) @@ -757,7 +781,6 @@ toReinsert.push_back(di); } } - it = _characters.erase(it); continue; } it++; _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit