gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv...
Date: Mon, 13 Nov 2006 08:34:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/11/13 08:34:26

Modified files:
        .              : ChangeLog 
        server         : sprite_instance.cpp sprite_instance.h 

Log message:
                * server/sprite_instance.{cpp,h}: drop all self-assignments
                  to intrusive_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&r1=1.1595&r2=1.1596
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.78&r2=1.79
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.36&r2=1.37

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.1595
retrieving revision 1.1596
diff -u -b -r1.1595 -r1.1596
--- ChangeLog   12 Nov 2006 18:17:03 -0000      1.1595
+++ ChangeLog   13 Nov 2006 08:34:26 -0000      1.1596
@@ -1,3 +1,11 @@
+2006-11-13 Sandro Santilli <address@hidden>
+
+       * server/sprite_instance.{cpp,h}: drop all self-assignments
+         to intrusive_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-12 Markus Gothe <address@hidden>
 
        * backend/render_handler_ogl.cpp: sprintf -> snprintf.

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -b -r1.78 -r1.79
--- server/sprite_instance.cpp  11 Nov 2006 22:44:54 -0000      1.78
+++ server/sprite_instance.cpp  13 Nov 2006 08:34:26 -0000      1.79
@@ -1137,11 +1137,12 @@
 // Take care of this frame's actions.
 void sprite_instance::do_actions()
 {
-    // Keep m_as_environment alive during any method calls!
-    boost::intrusive_ptr<as_object>    this_ptr(this);
+       testInvariant();
 
     execute_actions(&m_as_environment, m_action_list);
     m_action_list.resize(0);
+
+       testInvariant();
 }
 
 size_t
@@ -1278,8 +1279,7 @@
 
 bool sprite_instance::on_event(const event_id& id)
 {
-           // Keep m_as_environment alive during any method calls!
-           boost::intrusive_ptr<as_object>     this_ptr(this);
+       testInvariant();
 
            bool called = false;
                        
@@ -1314,6 +1314,8 @@
                    }
            }
 
+       testInvariant();
+
            return called;
 }
 
@@ -1751,11 +1753,9 @@
 void
 sprite_instance::execute_frame_tags(size_t frame, bool state_only)
 {
-       init_builtins(get_environment().get_version());
+       testInvariant();
 
-
-       // Keep this (particularly m_as_environment) alive during execution!
-       boost::intrusive_ptr<as_object> this_ptr(this);
+       init_builtins(get_environment().get_version());
 
        assert(frame < m_def->get_frame_count());
 
@@ -1789,15 +1789,15 @@
                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)
 {
-       init_builtins(get_environment().get_version());
-
+       testInvariant();
 
-       // Keep this (particularly m_as_environment) alive during execution!
-       boost::intrusive_ptr<as_object> this_ptr(this);
+       init_builtins(get_environment().get_version());
 
        assert(frame < m_def->get_frame_count());
 
@@ -1808,6 +1808,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.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- server/sprite_instance.h    11 Nov 2006 22:44:54 -0000      1.36
+++ server/sprite_instance.h    13 Nov 2006 08:34:26 -0000      1.37
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: sprite_instance.h,v 1.36 2006/11/11 22:44:54 strk Exp $ */
+/* $Id: sprite_instance.h,v 1.37 2006/11/13 08:34:26 strk Exp $ */
 
 // Stateful live Sprite instance
 
@@ -497,6 +497,13 @@
                return m_display_list.getNextHighestDepth();
        }
 
+       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 
boost::intrusive_ptr
+       }
+
 
 private:
 




reply via email to

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