[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/character.cpp server/cha...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/character.cpp server/cha... |
Date: |
Thu, 04 Oct 2007 09:47:37 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/10/04 09:47:37
Modified files:
. : ChangeLog
server : character.cpp character.h movie_root.cpp
sprite_instance.cpp sprite_instance.h
Log message:
* server/character.{cpp,h}: add destroy() and isDestroyed()
members. Will surely help with soft references and hopefully
with opcode guarding too.
* server/movie_root.cpp (cleanupDisplayList): call destroy()
on unloaded but still not destroyed characters.
* server/sprite_instance.{cpp,h}: override destroy() to remove
properties.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4519&r2=1.4520
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.cpp?cvsroot=gnash&r1=1.57&r2=1.58
http://cvs.savannah.gnu.org/viewcvs/gnash/server/character.h?cvsroot=gnash&r1=1.97&r2=1.98
http://cvs.savannah.gnu.org/viewcvs/gnash/server/movie_root.cpp?cvsroot=gnash&r1=1.104&r2=1.105
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.364&r2=1.365
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.143&r2=1.144
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4519
retrieving revision 1.4520
diff -u -b -r1.4519 -r1.4520
--- ChangeLog 4 Oct 2007 09:37:49 -0000 1.4519
+++ ChangeLog 4 Oct 2007 09:47:35 -0000 1.4520
@@ -1,3 +1,13 @@
+2007-10-04 Sandro Santilli <address@hidden>
+
+ * server/character.{cpp,h}: add destroy() and isDestroyed()
+ members. Will surely help with soft references and hopefully
+ with opcode guarding too.
+ * server/movie_root.cpp (cleanupDisplayList): call destroy()
+ on unloaded but still not destroyed characters.
+ * server/sprite_instance.{cpp,h}: override destroy() to remove
+ properties.
+
2007-10-04 Tomas Groth Christensen <address@hidden>
* libmedia/gst/gstappsink.{c,h}: Updated to match latest gstreamer cvs.
Index: server/character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/character.cpp,v
retrieving revision 1.57
retrieving revision 1.58
diff -u -b -r1.57 -r1.58
--- server/character.cpp 27 Sep 2007 23:06:56 -0000 1.57
+++ server/character.cpp 4 Oct 2007 09:47:36 -0000 1.58
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: character.cpp,v 1.57 2007/09/27 23:06:56 strk Exp $ */
+/* $Id: character.cpp,v 1.58 2007/10/04 09:47:36 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -896,6 +896,19 @@
}
#endif
+void
+character::destroy()
+{
+ /// We can't be destroyed w/out being unloaded first, right ?
+ /// we may change this in the future...
+ assert(isUnloaded());
+
+ /// We don't destroy ourself twice, right ?
+ assert(!_destroyed);
+
+ _destroyed = true;
+}
+
} // namespace gnash
Index: server/character.h
===================================================================
RCS file: /sources/gnash/gnash/server/character.h,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- server/character.h 27 Sep 2007 23:06:56 -0000 1.97
+++ server/character.h 4 Oct 2007 09:47:36 -0000 1.98
@@ -19,7 +19,7 @@
//
//
-/* $Id: character.h,v 1.97 2007/09/27 23:06:56 strk Exp $ */
+/* $Id: character.h,v 1.98 2007/10/04 09:47:36 strk Exp $ */
#ifndef GNASH_CHARACTER_H
#define GNASH_CHARACTER_H
@@ -143,6 +143,9 @@
/// Set to yes when this instance has been unloaded
bool _unloaded;
+ /// This flag should be set to true by a call to destroy()
+ bool _destroyed;
+
/// Build the _target member recursive on parent
std::string computeTargetPath() const;
@@ -393,6 +396,7 @@
m_display_callback(NULL),
m_display_callback_user_ptr(NULL),
_unloaded(false),
+ _destroyed(false),
m_visible(true),
m_parent(parent),
m_invalidated(true),
@@ -1029,6 +1033,26 @@
bool isUnloaded() { return _unloaded; }
+ /// Mark this character as destroyed
+ //
+ /// A character should be destroyed when is removed from the display
+ /// list and is not more needed for names (target) resolutions.
+ /// Sprites are needed for names resolution whenever themselves
+ /// or a contained object has an onUnload event handler defined,
+ /// in which case we want the event handler to find the 'this'
+ /// variable w/out attempting to rebind it.
+ ///
+ /// Note: this function can safely release most memory associated
+ /// with the character as it will not be needed anymore.
+ ///
+ virtual void destroy();
+
+ /// Return true if this character was destroyed.
+ //
+ /// See destroy() for more info.
+ ///
+ bool isDestroyed() const { return _destroyed; }
+
public: // istn't this 'public' reduntant ?
/// Return full path to this object, in slash notation
Index: server/movie_root.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/movie_root.cpp,v
retrieving revision 1.104
retrieving revision 1.105
diff -u -b -r1.104 -r1.105
--- server/movie_root.cpp 2 Oct 2007 15:44:51 -0000 1.104
+++ server/movie_root.cpp 4 Oct 2007 09:47:36 -0000 1.105
@@ -1296,7 +1296,23 @@
#endif
// Remove unloaded characters from the _liveChars list
- _liveChars.remove_if(boost::bind(&character::isUnloaded, _1));
+ for (LiveChars::iterator i=_liveChars.begin(), e=_liveChars.end();
i!=e;)
+ {
+ AdvanceableCharacter ch = *i;
+ if ( ch->isUnloaded() )
+ {
+ // the sprite might have been destroyed already
+ // by effect of an unload() call with no onUnload
+ // handlers available either in self or child
+ // characters
+ if ( ! ch->isDestroyed() ) ch->destroy();
+ i = _liveChars.erase(i);
+ }
+ else
+ {
+ ++i;
+ }
+ }
#ifdef GNASH_DEBUG_INSTANCE_LIST
if ( _liveChars.size() > maxLiveChars )
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.364
retrieving revision 1.365
diff -u -b -r1.364 -r1.365
--- server/sprite_instance.cpp 3 Oct 2007 07:52:47 -0000 1.364
+++ server/sprite_instance.cpp 4 Oct 2007 09:47:36 -0000 1.365
@@ -1709,6 +1709,7 @@
m_has_mouse_event(false),
_text_variables(),
m_sound_stream_id(-1),
+ _origTarget(),
m_def(def)
{
assert(m_def != NULL);
@@ -1729,6 +1730,8 @@
sprite_instance::~sprite_instance()
{
+ // We might have been deleted by Quit...
+ //assert(isDestroyed());
if (m_has_key_event)
{
@@ -3448,8 +3451,11 @@
// it would require _drawable_inst to possibly be NULL,
// which wouldn't be bad at all actually...
- return character::unload() || childHaveUnloadHandler;
+ bool selfHaveUnloadHandler = character::unload();
+ bool shouldKeepAlive = ( selfHaveUnloadHandler ||
childHaveUnloadHandler );
+
+ return shouldKeepAlive;
}
void
@@ -3775,4 +3781,13 @@
}
#endif // GNASH_USE_GC
+void
+sprite_instance::destroy()
+{
+ /// We don't need these anymore
+ clearProperties();
+
+ character::destroy();
+}
+
} // namespace gnash
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- server/sprite_instance.h 25 Sep 2007 14:57:05 -0000 1.143
+++ server/sprite_instance.h 4 Oct 2007 09:47:37 -0000 1.144
@@ -397,6 +397,22 @@
/// See character::unload for more info
bool unload();
+ /// Mark this sprite as destroyed
+ //
+ /// This is an override of character::destroy()
+ ///
+ /// A sprite should be destroyed when is removed from the display
+ /// list and is not more needed for names (target) resolutions.
+ /// Sprites are needed for names resolution whenever themselves
+ /// or a contained object has an onUnload event handler defined,
+ /// in which case we want the event handler to find the 'this'
+ /// variable w/out attempting to rebind it.
+ ///
+ /// Note: this function will release most memory associated with
+ /// the sprite as no members or drawable should be needed anymore.
+ ///
+ void destroy();
+
/// See DisplayList::move_display_object, this method is just a proxy
to that...
//
/// @param color_xform
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/character.cpp server/cha...,
Sandro Santilli <=