+ /// @param allowUnloaded + /// If true an unloaded sprite is still returned as such, + /// rather then attempted to be resolved as a soft-reference. + /// Main use for this is during paths resolution, to avoid + /// infinite loops. See bug #21647. + /// + sprite_instance* to_sprite(bool allowUnloaded=false) const;
In which scenario we are not allowed to access an unloaded sprites? Shouldn't to_sprite() always allow unloaded characters? --zou On Nov 27, 2007 4:43 AM, Sandro Santilli <[EMAIL PROTECTED]> wrote: > CVSROOT: /sources/gnash > Module name: gnash > Changes by: Sandro Santilli <strk> 07/11/26 20:43:47 > > Modified files: > . : ChangeLog > server : as_value.cpp as_value.h sprite_instance.cpp > > Log message: > Don't re-bound dangling sprites during evaluation of soft references. > Fixes bug #21647 but we don't have an automated test for it yet. > > CVSWeb URLs: > http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4971&r2=1.4972 > http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.98&r2=1.99 > http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.74&r2=1.75 > http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.396&r2=1.397 > > Patches: > Index: ChangeLog > =================================================================== > RCS file: /sources/gnash/gnash/ChangeLog,v > retrieving revision 1.4971 > retrieving revision 1.4972 > diff -u -b -r1.4971 -r1.4972 > --- ChangeLog 26 Nov 2007 20:11:04 -0000 1.4971 > +++ ChangeLog 26 Nov 2007 20:43:46 -0000 1.4972 > @@ -1,3 +1,11 @@ > +2007-11-26 Sandro Santilli <[EMAIL PROTECTED]> > + > + * server/as_value.{cpp,h}: add is_sprite() and a way to get the sprite > + value w/out re-evaluating path. > + * server/sprite_instance.cpp (get_path_element): don't re-evaluate > + target paths of unloaded sprites while getting path elements. > + Needs more testing, but for now it fixes bug #21647. > + > 2007-11-26 Benjamin Wolsey <[EMAIL PROTECTED]> > > * server/asobj/NetStreamFfmpeg.{cpp,h}: add PktPointer class > > Index: server/as_value.cpp > =================================================================== > RCS file: /sources/gnash/gnash/server/as_value.cpp,v > retrieving revision 1.98 > retrieving revision 1.99 > diff -u -b -r1.98 -r1.99 > --- server/as_value.cpp 21 Nov 2007 09:21:49 -0000 1.98 > +++ server/as_value.cpp 26 Nov 2007 20:43:47 -0000 1.99 > @@ -595,11 +595,11 @@ > } > > sprite_instance* > -as_value::to_sprite() const > +as_value::to_sprite(bool allowUnloaded) const > { > if ( m_type != MOVIECLIP ) return NULL; > > - return getSprite(); > + return getSprite(allowUnloaded); > } > > void > @@ -1296,10 +1296,10 @@ > } > > as_value::SpritePtr > -as_value::getSprite() const > +as_value::getSprite(bool allowUnloaded) const > { > assert(m_type == MOVIECLIP); > - return boost::get<SpriteProxy>(_value).get(); > + return boost::get<SpriteProxy>(_value).get(allowUnloaded); > } > > void > > Index: server/as_value.h > =================================================================== > RCS file: /sources/gnash/gnash/server/as_value.h,v > retrieving revision 1.74 > retrieving revision 1.75 > diff -u -b -r1.74 -r1.75 > --- server/as_value.h 20 Nov 2007 00:44:03 -0000 1.74 > +++ server/as_value.h 26 Nov 2007 20:43:47 -0000 1.75 > @@ -15,7 +15,7 @@ > // along with this program; if not, write to the Free Software > // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA > > -/* $Id: as_value.h,v 1.74 2007/11/20 00:44:03 cmusick Exp $ */ > +/* $Id: as_value.h,v 1.75 2007/11/26 20:43:47 strk Exp $ */ > > #ifndef GNASH_AS_VALUE_H > #define GNASH_AS_VALUE_H > @@ -261,6 +261,14 @@ > return m_type == OBJECT || m_type == AS_FUNCTION || m_type == > MOVIECLIP; > } > > + /// \brief > + /// Return true if this value is a MOVIECLIP > + /// > + bool is_sprite() const > + { > + return m_type == MOVIECLIP; > + } > + > /// Get a std::string representation for this value. > // > /// @param env > @@ -371,7 +379,13 @@ > /// Note that if the value is NOT a MOVIECLIP, NULL is always > /// returned. > /// > - sprite_instance* to_sprite() const; > + /// @param allowUnloaded > + /// If true an unloaded sprite is still returned as such, > + /// rather then attempted to be resolved as a soft-reference. > + /// Main use for this is during paths resolution, to avoid > + /// infinite loops. See bug #21647. > + /// > + sprite_instance* to_sprite(bool allowUnloaded=false) const; > > /// \brief > /// Return value as an ActionScript function ptr > @@ -613,8 +627,10 @@ > // > /// @return the currently bound sprite, NULL if none > /// > - sprite_instance* get() const > + sprite_instance* get(bool allowUnloaded=false) const > { > + if ( allowUnloaded ) return _ptr; > + > checkDangling(); // set _ptr to NULL and _tgt to > original target if destroyed > if ( _ptr ) return _ptr; > else return find_sprite_by_target(_tgt); > @@ -693,7 +709,7 @@ > // > /// NOTE: this is possibly NULL ! > /// > - SpritePtr getSprite() const; > + SpritePtr getSprite(bool allowUnloaded=false) const; > > /// Get the sprite proxy variant member (we assume m_type == > MOVIECLIP) > // > > Index: server/sprite_instance.cpp > =================================================================== > RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v > retrieving revision 1.396 > retrieving revision 1.397 > diff -u -b -r1.396 -r1.397 > --- server/sprite_instance.cpp 24 Nov 2007 17:21:44 -0000 1.396 > +++ server/sprite_instance.cpp 26 Nov 2007 20:43:47 -0000 1.397 > @@ -2345,6 +2345,11 @@ > { > return NULL; > } > + if ( tmp.is_sprite() ) > + { > + return tmp.to_sprite(true); > + } > + > return tmp.to_object().get(); > } > > > > _______________________________________________ > Gnash-commit mailing list > Gnash-commit@gnu.org > http://lists.gnu.org/mailman/listinfo/gnash-commit > _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit