[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... [relea
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... [release_0_7_2] |
Date: |
Mon, 13 Nov 2006 08:21:15 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Branch: release_0_7_2
Changes by: Sandro Santilli <strk> 06/11/13 08:21:15
Modified files:
. : ChangeLog
server : sprite_instance.cpp sprite_instance.h
Log message:
* server/sprite_instance.{cpp,h}: drop all self-assignments
to smart_ptr used as a mean to keep ourselves alive (sounds
dangerous and confusing); added a testInvariant() inline
method and called from all function modified in such a way.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.1412.2.152&r2=1.1412.2.153
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.69.2.6&r2=1.69.2.7
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&only_with_tag=release_0_7_2&r1=1.32.2.2&r2=1.32.2.3
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1412.2.152
retrieving revision 1.1412.2.153
diff -u -b -r1.1412.2.152 -r1.1412.2.153
--- ChangeLog 11 Nov 2006 17:05:00 -0000 1.1412.2.152
+++ ChangeLog 13 Nov 2006 08:21:14 -0000 1.1412.2.153
@@ -1,3 +1,10 @@
+2006-11-13 Sandro Santilli <address@hidden>
+
+ * server/sprite_instance.{cpp,h}: drop all self-assignments
+ to smart_ptr used as a mean to keep ourselves alive (sounds
+ dangerous and confusing); added a testInvariant() inline
+ method and called from all function modified in such a way.
+
2006-11-11 Sandro Santilli <address@hidden>
* Makefile.am (mudflap and mudlfap-check rules):
Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.69.2.6
retrieving revision 1.69.2.7
diff -u -b -r1.69.2.6 -r1.69.2.7
--- server/sprite_instance.cpp 7 Nov 2006 16:24:04 -0000 1.69.2.6
+++ server/sprite_instance.cpp 13 Nov 2006 08:21:15 -0000 1.69.2.7
@@ -1050,11 +1050,16 @@
// Take care of this frame's actions.
void sprite_instance::do_actions()
{
+ testInvariant();
+
// Keep m_as_environment alive during any method calls!
- smart_ptr<as_object> this_ptr(this);
+ // Don't do this, make sure caller is keeping us alive instead
+ //smart_ptr<as_object> this_ptr(this);
execute_actions(&m_as_environment, m_action_list);
m_action_list.resize(0);
+
+ testInvariant();
}
size_t
@@ -1188,8 +1193,11 @@
bool sprite_instance::on_event(event_id id)
{
+ testInvariant();
+
// Keep m_as_environment alive during any method calls!
- smart_ptr<as_object> this_ptr(this);
+ // Don't do this, make sure caller is keeping us alive instead
+ //smart_ptr<as_object> this_ptr(this);
bool called = false;
@@ -1224,6 +1232,8 @@
}
}
+ testInvariant();
+
return called;
}
@@ -1661,11 +1671,14 @@
void
sprite_instance::execute_frame_tags(size_t frame, bool state_only)
{
+ testInvariant();
+
init_builtins(get_environment().get_version());
// Keep this (particularly m_as_environment) alive during execution!
- smart_ptr<as_object> this_ptr(this);
+ // Don't do this, make sure caller is keeping us alive instead
+ //smart_ptr<as_object> this_ptr(this);
assert(frame < m_def->get_frame_count());
@@ -1699,15 +1712,20 @@
std::for_each(playlist.begin(), playlist.end(),
std::bind2nd(std::mem_fun(&execute_tag::execute),
this));
}
+
+ testInvariant();
}
void sprite_instance::execute_frame_tags_reverse(size_t frame)
{
+ testInvariant();
+
init_builtins(get_environment().get_version());
// Keep this (particularly m_as_environment) alive during execution!
- smart_ptr<as_object> this_ptr(this);
+ // Don't do this, make sure caller is keeping us alive instead
+ //smart_ptr<as_object> this_ptr(this);
assert(frame < m_def->get_frame_count());
@@ -1718,6 +1736,8 @@
execute_tag* e = playlist[i];
e->execute_state_reverse(this, frame);
}
+
+ testInvariant();
}
void sprite_instance::execute_remove_tags(int frame)
Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.32.2.2
retrieving revision 1.32.2.3
diff -u -b -r1.32.2.2 -r1.32.2.3
--- server/sprite_instance.h 31 Oct 2006 12:54:46 -0000 1.32.2.2
+++ server/sprite_instance.h 13 Nov 2006 08:21:15 -0000 1.32.2.3
@@ -17,7 +17,7 @@
//
//
-/* $Id: sprite_instance.h,v 1.32.2.2 2006/10/31 12:54:46 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.32.2.3 2006/11/13 08:21:15 strk Exp $ */
// Stateful live Sprite instance
@@ -497,6 +497,17 @@
return m_display_list.getNextHighestDepth();
}
+ // TODO:
+ // Call this function as first thing of any public inspector
+ // and as last thing of any public mutator .
+ // Improve test to include some more consistency checks
+ void testInvariant() const {
+ assert(m_play_state == PLAY || m_play_state == STOP);
+ assert(m_current_frame < m_def->get_frame_count());
+ assert(get_ref_count() > 0); // or we're constructed but
+ // not stored in a smart_ptr
+ }
+
private:
- [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... [release_0_7_2],
Sandro Santilli <=