gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/as_value.cpp server/as_v...
Date: Wed, 19 Dec 2007 20:40:32 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/19 20:40:32

Modified files:
        .              : ChangeLog 
        server         : as_value.cpp as_value.h 
                         button_character_instance.cpp character.h 
                         movie_instance.cpp sprite_instance.cpp 
                         sprite_instance.h video_stream_instance.cpp 
        testsuite      : DummyCharacter.h simple.exp 
        testsuite/actionscript.all: TextField.as 
        testsuite/server: DisplayListTest.cpp Makefile.am 

Log message:
        Generalize soft-ref to apply to *any* character which is saved into an 
as_value.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5221&r2=1.5222
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.106&r2=1.107
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.79&r2=1.80
http://cvs.savannah.gnu.org/viewcvs/gnash/server/button_character_instance.cpp?cvsroot=gnash&r1=1.69&r2=1.70
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.115&r2=1.116
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_instance.cpp?cvsroot=gnash&r1=1.21&r2=1.22
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.416&r2=1.417
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.159&r2=1.160
http://cvs.savannah.gnu.org/viewcvs/gnash/server/video_stream_instance.cpp?cvsroot=gnash&r1=1.44&r2=1.45
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/DummyCharacter.h?cvsroot=gnash&r1=1.4&r2=1.5
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/simple.exp?cvsroot=gnash&r1=1.13&r2=1.14
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/TextField.as?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/DisplayListTest.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/server/Makefile.am?cvsroot=gnash&r1=1.34&r2=1.35

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5221
retrieving revision 1.5222
diff -u -b -r1.5221 -r1.5222
--- ChangeLog   19 Dec 2007 19:40:21 -0000      1.5221
+++ ChangeLog   19 Dec 2007 20:40:30 -0000      1.5222
@@ -1,3 +1,22 @@
+2007-12-19 Sandro Santilli <address@hidden>
+
+       * server/as_value.{cpp,h}: turn SpriteProxy to a generic
+         CharacterProxy, keep all characters by soft-refs.
+       * server/character.h: expose a getOrigTarget and provide
+         a saveOriginalTarget to subclasses intended to be called by
+         stage placement callbacks.
+       * server/button_character_instance.cpp, server/movie_instance.cpp,
+         server/sprite_instance.{cpp,h}, video_stream_instance.cpp:
+         Call saveOriginalTarget from the overridden stagePlacementCallback.
+       * testsuite/DummyCharacter.h, testsuite/server/DisplayListTest.cpp:
+         make DummyCharacter take a 'parent' argument, to avoid failing
+         an assertion in getTarget checking for characters with no parent
+         to be in effect of the movie_instance class of derivates.
+       * testsuite/server/Makefile.am: don't let failures in server
+         testsuite interrupt the check run.
+       * testsuite/simple.exp: comment units of the timeout
+       * testsuite/actionscript.all/TextField.as: soft-ref tests succeed.
+
 2007-12-19  Rob Savoye  <address@hidden>
 
        * server/asobj/SharedObject.cpp: Add handler for properties
@@ -6,19 +25,19 @@
        * libamf/amf.cpp: Comment out function traces.
        * libamf/sol.cpp: Trap undefiend filespec.
 
-2007-12-18 Sandro Santilli <address@hidden>
+2007-12-19 Sandro Santilli <address@hidden>
 
        * server/edit_text_character.{cpp,h}:
          implement removeTextField().
        * testsuite/actionscript.all/TextField.as: update expected
          results (2 xpass, 2 fail - used to suceed by luck).
 
-2007-12-18 Sandro Santilli <address@hidden>
+2007-12-19 Sandro Santilli <address@hidden>
 
        * testsuite/actionscript.all/TextField.as: add tests for
          TextField soft references (unimplemented in Gnash).
 
-2007-12-18 Sandro Santilli <address@hidden>
+2007-12-19 Sandro Santilli <address@hidden>
 
        * server/edit_text_character.cpp: implement getDepth()
        * server/sprite_instance.cpp make createTextField more

Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.106
retrieving revision 1.107
diff -u -b -r1.106 -r1.107
--- server/as_value.cpp 14 Dec 2007 20:51:20 -0000      1.106
+++ server/as_value.cpp 19 Dec 2007 20:40:31 -0000      1.107
@@ -25,6 +25,7 @@
 #include "as_object.h"
 #include "as_function.h" // for as_function
 #include "sprite_instance.h" // for MOVIECLIP values
+#include "character.h" // for MOVIECLIP values
 #include "as_environment.h" // for MOVIECLIP values
 #include "VM.h" // for MOVIECLIP values
 #include "movie_root.h" // for MOVIECLIP values
@@ -116,7 +117,7 @@
 
                case MOVIECLIP:
                {
-                       const SpriteProxy& sp = getSpriteProxy();
+                       const CharacterProxy& sp = getCharacterProxy();
                        if ( sp.isDangling() )
                        {
                                return "";
@@ -309,7 +310,7 @@
 #if 1
                if ( m_type == MOVIECLIP )
                {
-                       return as_value(getSpriteProxy().getTarget());
+                       return as_value(getCharacterProxy().getTarget());
                }
 #endif
 
@@ -626,7 +627,7 @@
                case MOVIECLIP:
                        // FIXME: update when to_sprite will return
                        //        an intrusive_ptr directly
-                       return ptr(to_sprite());
+                       return ptr(to_character());
 
                case STRING:
                        return init_string_instance(getStr().c_str());
@@ -646,17 +647,33 @@
 sprite_instance*
 as_value::to_sprite(bool allowUnloaded) const
 {
+       if ( m_type != MOVIECLIP ) return 0;
+
+       character *ch = getCharacter(allowUnloaded);
+       if ( ! ch ) return 0;
+       return ch->to_movie();
+}
+
+character*
+as_value::to_character(bool allowUnloaded) const
+{
        if ( m_type != MOVIECLIP ) return NULL;
 
-       return getSprite(allowUnloaded);
+       return getCharacter(allowUnloaded);
 }
 
 void
 as_value::set_sprite(sprite_instance& sprite)
 {
+       set_character(sprite);
+}
+
+void
+as_value::set_character(character& sprite)
+{
        drop_refs();
        m_type = MOVIECLIP;
-       _value = SpriteProxy(&sprite);
+       _value = CharacterProxy(&sprite);
 }
 
 // Return value as an ActionScript function.  Returns NULL if value is
@@ -725,10 +742,10 @@
                set_null();
                return;
        }
-       sprite_instance* sp = obj->to_movie();
+       character* sp = obj->to_character();
        if ( sp )
        {
-               set_sprite(*sp);
+               set_character(*sp);
                return;
        }
        as_function* func = obj->to_function();
@@ -999,7 +1016,12 @@
                        return "object";
 
                case as_value::MOVIECLIP:
-                       return "movieclip";
+               {
+                       character* ch = getCharacter();
+                       if ( ! ch ) return "movieclip"; // dangling
+                       if ( ch->to_movie() ) return "movieclip"; // bound to 
movieclip
+                       return "object"; // bound to some other character
+               }
 
                case as_value::NULLTYPE:
                        return "null";
@@ -1037,7 +1059,7 @@
                        return _value == v._value;
 
                case MOVIECLIP:
-                       return to_sprite() == v.to_sprite(); 
+                       return to_character() == v.to_character(); 
 
                case NUMBER:
                {
@@ -1106,22 +1128,27 @@
                }
                case MOVIECLIP:
                {
-                       const SpriteProxy& sp = getSpriteProxy();
+                       const CharacterProxy& sp = getCharacterProxy();
                        if ( sp.isDangling() )
                        {
-                               sprite_instance* rebound = sp.get();
+                               character* rebound = sp.get();
                                if ( rebound )
                                {
-                                       snprintf(buf, 511, "[rebound 
movieclip(%s):%p]", sp.getTarget().c_str(), rebound);
+                                       snprintf(buf, 511, "[rebound 
%s(%s):%p]",
+                                               typeName(*rebound).c_str(),
+                                               sp.getTarget().c_str(),
+                                               (void*)rebound);
                                }
                                else
                                {
-                                       snprintf(buf, 511, "[dangling 
movieclip:%s]", sp.getTarget().c_str());
+                                       snprintf(buf, 511, "[dangling 
character:%s]",
+                                               sp.getTarget().c_str());
                                }
                        }
                        else
                        {
-                               snprintf(buf, 511, "[movieclip(%s):%p]", 
sp.getTarget().c_str(), (void *)sp.get());
+                               character* ch = sp.get();
+                               snprintf(buf, 511, "[%s(%s):%p]", 
typeName(*ch).c_str(), sp.getTarget().c_str(), (void *)ch);
                        }
                        buf[511] = '\0';
                        return buf;
@@ -1317,7 +1344,7 @@
                }
                case MOVIECLIP:
                {
-                       as_value::SpriteProxy sp = getSpriteProxy();
+                       as_value::CharacterProxy sp = getCharacterProxy();
                        sp.setReachable();
                        break;
                }
@@ -1340,18 +1367,26 @@
        return boost::get<AsObjPtr>(_value);
 }
 
-as_value::SpriteProxy
-as_value::getSpriteProxy() const
+as_value::CharacterProxy
+as_value::getCharacterProxy() const
 {
        assert(m_type == MOVIECLIP);
-       return boost::get<SpriteProxy>(_value);
+       return boost::get<CharacterProxy>(_value);
+}
+
+as_value::CharacterPtr
+as_value::getCharacter(bool allowUnloaded) const
+{
+       return getCharacterProxy().get(allowUnloaded);
 }
 
 as_value::SpritePtr
 as_value::getSprite(bool allowUnloaded) const
 {
        assert(m_type == MOVIECLIP);
-       return boost::get<SpriteProxy>(_value).get(allowUnloaded);
+       character* ch = getCharacter(allowUnloaded);
+       if ( ! ch ) return 0;
+       return ch->to_movie();
 }
 
 void
@@ -1466,12 +1501,12 @@
 }
 
 //-------------------------------------
-// as_value::SpriteProxy
+// as_value::CharacterProxy
 //-------------------------------------
 
 /* static private */
-sprite_instance*
-as_value::SpriteProxy::find_sprite_by_target(const std::string& tgtstr)
+character*
+as_value::CharacterProxy::find_character_by_target(const std::string& tgtstr)
 {
        if ( tgtstr.empty() ) return NULL;
 
@@ -1481,7 +1516,7 @@
 
        // TODO: for another optimization we may cache
        //       the string_table::key for each element
-       //       as the SpriteProxy target (instead of
+       //       as the CharacterProxy target (instead of
        //       the full string, to be parsed everytime)
 
        //string::size_type size = tgtstr.size();
@@ -1491,27 +1526,29 @@
                string part(tgtstr, from, to-from);
                o = o->get_path_element(st.find(part));
                if ( ! o ) {
-                       log_debug("Target path element %s not found", 
part.c_str());
+                       log_debug("Evaluating target path for soft ref 
rebinding: element '%s' of path '%s' not found",
+                               part.c_str(), tgtstr.c_str());
                        return NULL;
                }
                if ( to == string::npos ) break;
                from = to+1;
        }
-       return o->to_movie();
+       return o->to_character();
 }
 
 void
-as_value::SpriteProxy::checkDangling() const
+as_value::CharacterProxy::checkDangling() const
 {
        if ( _ptr && _ptr->isDestroyed() ) 
        {
                _tgt = _ptr->getOrigTarget();
+               log_debug("char %s was destroyed, stored it's orig target (%s) 
for later rebinding", _ptr->getTarget().c_str(), _tgt.c_str());
                _ptr = 0;
        }
 }
 
 std::string
-as_value::SpriteProxy::getTarget() const
+as_value::CharacterProxy::getTarget() const
 {
        checkDangling(); // set _ptr to NULL and _tgt to original target if 
destroyed
        if ( _ptr ) return _ptr->getTarget();
@@ -1519,7 +1556,7 @@
 }
 
 void
-as_value::SpriteProxy::setReachable() const
+as_value::CharacterProxy::setReachable() const
 {
        checkDangling();
        if ( _ptr ) _ptr->setReachable();

Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -b -r1.79 -r1.80
--- server/as_value.h   4 Dec 2007 11:45:28 -0000       1.79
+++ server/as_value.h   19 Dec 2007 20:40:31 -0000      1.80
@@ -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.79 2007/12/04 11:45:28 strk Exp $ */
+/* $Id: as_value.h,v 1.80 2007/12/19 20:40:31 strk Exp $ */
 
 #ifndef GNASH_AS_VALUE_H
 #define GNASH_AS_VALUE_H
@@ -41,6 +41,7 @@
 class fn_call;
 class as_function;
 class sprite_instance;
+class character;
 class asNamespace;
 class asName;
 
@@ -369,22 +370,28 @@
 
        /// Return value as a sprite or NULL if this is not possible.
        //
-       /// If the value is a MOVIECLIP value, the stored sprite target
-       /// is evaluated using the root movie's environment
-       /// (see gnash::as_environment::find_target). If the target
-       /// points to something that doesn't cast to a sprite,
+       /// This is just a wrapper around to_character() performing 
+       /// an additional final cast.
+       ///
+       sprite_instance* to_sprite(bool skipRebinding=false) const;
+
+       /// Return value as a character or NULL if this is not possible.
+       //
+       /// If the value is a MOVIECLIP value, the stored character target
+       /// is evaluated using the root movie's environment.
+       /// If the target points to something that doesn't cast to a character,
        /// NULL is returned.
        ///
-       /// Note that if the value is NOT a MOVIECLIP, NULL is always
+       /// Note that if the value is NOT a MOVIECLIP type, NULL is always
        /// returned.
        ///
        /// @param skipRebinding
-       ///     If true a reference to a destroyed sprite is still returned
+       ///     If true a reference to a destroyed character 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 skipRebinding=false) const;
+       character* to_character(bool skipRebinding=false) const;
 
        /// \brief
        /// Return value as an ActionScript function ptr
@@ -463,6 +470,8 @@
 
        void    set_sprite(sprite_instance& sp);
 
+       void    set_character(character& sp);
+
        void    set_int(int val) { set_double(val); }
 
        void    set_nan() { set_double(NAN); }
@@ -559,19 +568,19 @@
 
 private:
 
-       /// A proxy for sprite pointers.
+       /// A proxy for character pointers.
        //
-       /// The proxy will store a pointer to a sprite_instance until the 
-       /// sprite is destroyed, in which case it will only store the original
+       /// The proxy will store a pointer to a character until the 
+       /// character is destroyed, in which case it will only store the 
original
        /// target path of it and always use that for rebinding when needed.
        ///
-       class SpriteProxy {
+       class CharacterProxy {
 
-               mutable sprite_instance* _ptr;
+               mutable character* _ptr;
 
                mutable std::string _tgt;
 
-               static sprite_instance* find_sprite_by_target(const 
std::string& target);
+               static character* find_character_by_target(const std::string& 
target);
 
                /// If we still have a sprite pointer check if it was destroyed
                /// in which case we drop the pointer and only keep the target.
@@ -579,25 +588,25 @@
 
        public:
 
-               /// Construct a SpriteProxy pointing to the given sprite
-               SpriteProxy(sprite_instance* sp)
+               /// Construct a CharacterProxy pointing to the given sprite
+               CharacterProxy(character* sp)
                        :
                        _ptr(sp)
                {
                        checkDangling();
                }
 
-               /// Construct a copy of the given SpriteProxy 
+               /// Construct a copy of the given CharacterProxy 
                //
                /// @param sp
-               ///     The SpriteProxy to make a copy of.
+               ///     The CharacterProxy to make a copy of.
                ///     NOTE: if the given proxy is dangling, this proxy
                ///           will also be dangling. If you want to 
                ///           create a non-dangling proxy you can
-               ///           use the constructor taking a sprite_instance
-               ///           as in SpriteProxy newProxy(oldProxy.get())
+               ///           use the constructor taking a character
+               ///           as in CharacterProxy newProxy(oldProxy.get())
                ///
-               SpriteProxy(const SpriteProxy& sp)
+               CharacterProxy(const CharacterProxy& sp)
                {
                        sp.checkDangling();
                        _ptr=sp._ptr;
@@ -607,14 +616,14 @@
                /// Make this proxy a copy of the given one
                //
                /// @param sp
-               ///     The SpriteProxy to make a copy of.
+               ///     The CharacterProxy to make a copy of.
                ///     NOTE: if the given proxy is dangling, this proxy
                ///           will also be dangling. If you want to 
                ///           create a non-dangling proxy you can
-               ///           use the constructor taking a sprite_instance
-               ///           as in SpriteProxy newProxy(oldProxy.get())
+               ///           use the constructor taking a character
+               ///           as in CharacterProxy newProxy(oldProxy.get())
                ///
-               SpriteProxy& operator=(const SpriteProxy& sp)
+               CharacterProxy& operator=(const CharacterProxy& sp)
                {
                        sp.checkDangling();
                        _ptr=sp._ptr;
@@ -626,13 +635,13 @@
                //
                /// @return the currently bound sprite, NULL if none
                ///
-               sprite_instance* get(bool skipRebinding=false) const
+               character* get(bool skipRebinding=false) const
                {
                        if ( skipRebinding ) 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);
+                       else return find_character_by_target(_tgt);
                }
 
                /// Get the sprite target, either current (if not dangling) or 
bounded-to one.
@@ -655,7 +664,7 @@
                /// Two sprite_proxies are equal if they point to the
                /// same sprite
                ///
-               bool operator==(const SpriteProxy& sp) const
+               bool operator==(const CharacterProxy& sp) const
                {
                        return get() == sp.get();
                }
@@ -684,6 +693,7 @@
        type    m_type;
 
        typedef sprite_instance* SpritePtr;
+       typedef character* CharacterPtr;
        typedef boost::intrusive_ptr<as_function> AsFunPtr;
        typedef boost::intrusive_ptr<as_object> AsObjPtr;
 
@@ -693,7 +703,7 @@
                          bool,         // BOOLEAN
                          AsObjPtr,     // OBJECT,
 //                        AsFuncPtr,   // AS_FUNCTION
-                         SpriteProxy,  // MOVIECLIP
+                         CharacterProxy,       // MOVIECLIP
                         std::string    // STRING 
                       > _value;
 
@@ -710,9 +720,15 @@
        ///
        SpritePtr getSprite(bool skipRebinding=false) const;
 
+       /// Get the character pointer variant member (we assume m_type == 
MOVIECLIP)
+       //
+       /// NOTE: this is possibly NULL !
+       ///
+       CharacterPtr getCharacter(bool skipRebinding=false) const;
+
        /// Get the sprite proxy variant member (we assume m_type == MOVIECLIP)
        //
-       SpriteProxy getSpriteProxy() const;
+       CharacterProxy getCharacterProxy() const;
 
        /// Get the number variant member (we assume m_type == NUMBER)
        double getNum() const

Index: server/button_character_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/button_character_instance.cpp,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -b -r1.69 -r1.70
--- server/button_character_instance.cpp        13 Dec 2007 23:01:15 -0000      
1.69
+++ server/button_character_instance.cpp        19 Dec 2007 20:40:31 -0000      
1.70
@@ -796,6 +796,8 @@
 void
 button_character_instance::stagePlacementCallback()
 {
+       saveOriginalTarget(); // for soft refs
+
        // Register this button instance as a live character
        // do we need this???
        _vm.getRoot().addLiveChar(this);
@@ -816,7 +818,7 @@
                ch->set_matrix(mat);
                ch->set_cxform(cx);
                ch->set_depth(ch_depth);
-               ch->set_parent(this);
+               assert(ch->get_parent() == this);
 
                if (ch->get_name().empty() && ch->wantsInstanceName()) 
                {

Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -b -r1.115 -r1.116
--- server/character.h  14 Dec 2007 20:51:20 -0000      1.115
+++ server/character.h  19 Dec 2007 20:40:31 -0000      1.116
@@ -19,7 +19,7 @@
 //
 //
 
-/* $Id: character.h,v 1.115 2007/12/14 20:51:20 strk Exp $ */
+/* $Id: character.h,v 1.116 2007/12/19 20:40:31 strk Exp $ */
 
 #ifndef GNASH_CHARACTER_H
 #define GNASH_CHARACTER_H
@@ -100,8 +100,22 @@
        /// The character masking this instance (if any)
        character* _mask;
 
+       /// Original target, as at construction time
+       std::string _origTarget;
+
 protected:
 
+       /// Register currently computable target as
+       /// the "original" one. This will be used by
+       /// soft references (as_value) and should be
+       /// called as soon as the stagePlacementCallback
+       /// is invoked.
+       ///
+       void saveOriginalTarget()
+       {
+               _origTarget=getTarget();
+       }
+
 #ifdef GNASH_USE_GC
        /// Mark all reachable resources, override from as_object.
        //
@@ -356,6 +370,7 @@
        _unloaded(false),
        _destroyed(false),
        _mask(0),
+       _origTarget(),
        m_visible(true),
        m_parent(parent),
        m_invalidated(true),
@@ -392,8 +407,12 @@
                        return m_parent.get();
        }
 
-    // for extern movie
-    void set_parent(character* parent) { m_parent = parent; }
+       /// for extern movie
+       void set_parent(character* parent)
+       {
+               assert(_origTarget.empty());
+               m_parent = parent;
+       }
 
     int        get_depth() const { return m_depth; }
 
@@ -528,7 +547,11 @@
                return isDynamicMask() || isMaskLayer();
        }
 
-    virtual void set_name(const char* name) { _name = name; }
+       /// Set character name, initializing the original target member
+       void set_name(const char* name)
+       {
+               _name = name;
+       }
 
     const std::string& get_name() const { return _name; }
 
@@ -1021,8 +1044,14 @@
        /// This function must be called when the character is placed on
        /// stage for the first time.
        ///
+       /// The character version of this call sets the original target
+       /// of the character, for soft references to work.
+       /// If you override the method remember to call saveOriginalTarget()
+       /// as the first thing.
+       ///
        virtual void stagePlacementCallback()
        {
+               saveOriginalTarget();
        }
 
        /// Unload this instance from the stage.
@@ -1070,6 +1099,17 @@
        ///
        std::string getTargetPath() const;
 
+       /// Return original target path to this object, in dot notation
+       /// as of at construction time.
+       //
+       /// This is needed to properly dereference dangling soft-references
+       /// See testcase misc-swfc.all/soft_reference_test1.sc
+       ///
+       const std::string& getOrigTarget() const
+       {
+               return _origTarget;
+       }
+
        /// Return full path to this object, in dot notation
        //
        /// e.g. "_level0.sprite1.sprite2.ourSprite"

Index: server/movie_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_instance.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- server/movie_instance.cpp   14 Dec 2007 20:51:20 -0000      1.21
+++ server/movie_instance.cpp   19 Dec 2007 20:40:31 -0000      1.22
@@ -47,6 +47,8 @@
 void
 movie_instance::stagePlacementCallback()
 {
+       saveOriginalTarget();
+
        //GNASH_REPORT_FUNCTION;
 
        assert ( get_root()->get_root() == this );

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.416
retrieving revision 1.417
diff -u -b -r1.416 -r1.417
--- server/sprite_instance.cpp  19 Dec 2007 09:40:54 -0000      1.416
+++ server/sprite_instance.cpp  19 Dec 2007 20:40:31 -0000      1.417
@@ -1787,7 +1787,6 @@
        m_has_mouse_event(false),
        _text_variables(),
        m_sound_stream_id(-1),
-       _origTarget(),
        m_def(def)
 {
        assert(m_def != NULL);
@@ -3292,6 +3291,8 @@
 {
        assert(!isUnloaded());
 
+       saveOriginalTarget();
+
        // We might have loaded NO frames !
        if ( get_loaded_frames() == 0 )
        {
@@ -3312,9 +3313,6 @@
        // Register this sprite as a live one
        _vm.getRoot().addLiveChar(this);
 
-       // Take note of our original target (for soft references)
-       _origTarget = getTarget();
-
        // Register this sprite as a core broadcasters listener
        registerAsListener();
 
@@ -3494,13 +3492,6 @@
        return shouldKeepAlive;
 }
 
-void
-sprite_instance::set_name(const char* name)
-{
-       _name = name;
-
-}
-
 bool
 sprite_instance::loadMovie(const URL& url)
 {

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -b -r1.159 -r1.160
--- server/sprite_instance.h    14 Dec 2007 22:01:24 -0000      1.159
+++ server/sprite_instance.h    19 Dec 2007 20:40:31 -0000      1.160
@@ -723,10 +723,6 @@
        /// Get the current m_sound_stream_id
        virtual int get_sound_stream_id() { return m_sound_stream_id;}
 
-       /// Override for character::set_name to proprely update
-       /// _target and _target_dot.
-       virtual void set_name(const char* name);
-
        /// Remove this sprite from the stage.
        //
        /// This function is intended to be called by 
@@ -810,17 +806,6 @@
        ///
        virtual void enumerateNonProperties(as_environment&) const;
 
-       /// Return original target path to this object, in dot notation
-       /// as of at construction time.
-       //
-       /// This is needed to properly dereference dangling soft-references
-       /// See testcase misc-swfc.all/soft_reference_test1.sc
-       ///
-       const std::string& getOrigTarget() const
-       {
-               return _origTarget;
-       }
-
        /// Delete characters removed from the stage
        /// from the display lists
        void cleanupDisplayList();
@@ -1020,8 +1005,6 @@
        /// soundid for current playing stream. If no stream set to -1
        int m_sound_stream_id;
 
-       std::string _origTarget;
-
        cxform _userCxform;
 
 protected:

Index: server/video_stream_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/video_stream_instance.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -u -b -r1.44 -r1.45
--- server/video_stream_instance.cpp    10 Dec 2007 20:17:17 -0000      1.44
+++ server/video_stream_instance.cpp    19 Dec 2007 20:40:32 -0000      1.45
@@ -17,7 +17,7 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 // 
 
-// $Id: video_stream_instance.cpp,v 1.44 2007/12/10 20:17:17 strk Exp $
+// $Id: video_stream_instance.cpp,v 1.45 2007/12/19 20:40:32 strk Exp $
 
 #include "sprite_instance.h"
 #include "video_stream_instance.h"
@@ -223,6 +223,8 @@
 void
 video_stream_instance::stagePlacementCallback()
 {
+    saveOriginalTarget(); // for softref
+
     // Register this video instance as a live character
     _vm.getRoot().addLiveChar(this);
 }

Index: testsuite/DummyCharacter.h
===================================================================
RCS file: /sources/gnash/gnash/testsuite/DummyCharacter.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- testsuite/DummyCharacter.h  1 Jul 2007 10:54:37 -0000       1.4
+++ testsuite/DummyCharacter.h  19 Dec 2007 20:40:32 -0000      1.5
@@ -49,9 +49,9 @@
 
 public:
 
-       DummyCharacter()
+       DummyCharacter(character* parent)
                :
-               character(NULL, -1)
+               character(parent, parent ? 0 : -1)
        {
        }
 

Index: testsuite/simple.exp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/simple.exp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- testsuite/simple.exp        27 Oct 2007 16:43:44 -0000      1.13
+++ testsuite/simple.exp        19 Dec 2007 20:40:32 -0000      1.14
@@ -12,6 +12,9 @@
 # This is to handle deadlocks. We don't reset the timeout when a match is
 # found to avoid hanging in case of a testcase sending matches in an infinite 
loops.
 # (not unlikely as it seems, think about flash movies...)
+#
+# Expressed in seconds.
+#
 set timeout 600
 set file all
 set params ""

Index: testsuite/actionscript.all/TextField.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/TextField.as,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- testsuite/actionscript.all/TextField.as     19 Dec 2007 18:40:07 -0000      
1.38
+++ testsuite/actionscript.all/TextField.as     19 Dec 2007 20:40:32 -0000      
1.39
@@ -19,7 +19,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: TextField.as,v 1.38 2007/12/19 18:40:07 strk Exp $";
+rcsid="$Id: TextField.as,v 1.39 2007/12/19 20:40:32 strk Exp $";
 
 #include "check.as"
 
@@ -610,18 +610,18 @@
 check_equals(softref.getDepth(), 23);
 hardref.removeTextField();
 check_equals(typeof(hardref), 'undefined');
-xcheck_equals(typeof(softref), 'movieclip'); // becomes a movieclip ??
-xcheck_equals(typeof(softref.prop), 'undefined');
+check_equals(typeof(softref), 'movieclip'); // a dangling character ref is 
always reported to be a 'movieclip' (historical reasons probably)
+check_equals(typeof(softref.prop), 'undefined');
 createEmptyMovieClip("hardref", 24);
 check_equals(typeof(hardref), 'movieclip');
 hardref.prop = 7;
-xcheck_equals(typeof(softref), 'movieclip');
-xcheck_equals(softref.prop, 7);
+check_equals(typeof(softref), 'movieclip');
+check_equals(softref.prop, 7); // and it's actually also rebound to one if 
available
 hardref.removeMovieClip();
 createTextField("hardref", 25, 10, 10, 160, 200);
 hardref.prop = 9;
 check_equals(typeof(softref), 'object'); // changes type on rebind
-xcheck_equals(softref.prop, 9);
+check_equals(softref.prop, 9);
 
 
 //-------------------------------------------------------------------------

Index: testsuite/server/DisplayListTest.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/DisplayListTest.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- testsuite/server/DisplayListTest.cpp        7 Dec 2007 15:34:37 -0000       
1.9
+++ testsuite/server/DisplayListTest.cpp        19 Dec 2007 20:40:32 -0000      
1.10
@@ -58,7 +58,9 @@
 
        ManualClock clock;
        VM& vm = VM::init(*md5, clock);
-       vm.getRoot().setRootMovie( md5->create_movie_instance() );
+
+       movie_instance* root = md5->create_movie_instance();
+       vm.getRoot().setRootMovie( root );
 
        DisplayList dlist1;
 
@@ -69,8 +71,8 @@
        check_equals(dlist1, dlist2);
 
        // just a couple of characters
-       boost::intrusive_ptr<character> ch1 ( new DummyCharacter() );
-       boost::intrusive_ptr<character> ch2 ( new DummyCharacter() );
+       boost::intrusive_ptr<character> ch1 ( new DummyCharacter(root) );
+       boost::intrusive_ptr<character> ch2 ( new DummyCharacter(root) );
 
        dlist1.place_character( ch1.get(), 1, color, mat, 0, 0);
        dlist1.place_character( ch2.get(), 2, color, mat, 0, 0);

Index: testsuite/server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/testsuite/server/Makefile.am,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- testsuite/server/Makefile.am        18 Oct 2007 11:47:56 -0000      1.34
+++ testsuite/server/Makefile.am        19 Dec 2007 20:40:32 -0000      1.35
@@ -110,7 +110,7 @@
 check-DEJAGNU: site-update $(TEST_CASES)
        @runtest=$(RUNTEST); \
        if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \
-           $$runtest $(RUNTESTFLAGS) $(TEST_DRIVERS); \
+           $$runtest $(RUNTESTFLAGS) $(TEST_DRIVERS); true; \
        else \
          echo "WARNING: could not find \`runtest'" 1>&2; \
           for i in "$(TEST_CASES)"; do \




reply via email to

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