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... [gnash


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/sprite_instance.cpp serv... [gnash_0_8_3_branch]
Date: Fri, 16 May 2008 11:04:26 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Branch:         gnash_0_8_3_branch
Changes by:     Sandro Santilli <strk>  08/05/16 11:04:26

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

Log message:
        * server/sprite_instance.{cpp,h}: remove unloaded TextField references
          from TextField variables container on ::cleanupDisplayList.
          Fixes bug #20076 (leak on curve_ball.swf).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.6573.2.16&r2=1.6573.2.17
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.533&r2=1.533.2.1
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&only_with_tag=gnash_0_8_3_branch&r1=1.196&r2=1.196.2.1

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6573.2.16
retrieving revision 1.6573.2.17
diff -u -b -r1.6573.2.16 -r1.6573.2.17
--- ChangeLog   16 May 2008 07:01:58 -0000      1.6573.2.16
+++ ChangeLog   16 May 2008 11:04:21 -0000      1.6573.2.17
@@ -1,3 +1,9 @@
+2008-05-16 Sandro Santilli <address@hidden>
+
+       * server/sprite_instance.{cpp,h}: remove unloaded TextField references
+         from TextField variables container on ::cleanupDisplayList.
+         Fixes bug #20076 (leak on curve_ball.swf).
+
 2008-05-15 Sandro Santilli <address@hidden>
 
        * README: remove section about impelmented/unimplemented as classes

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.533
retrieving revision 1.533.2.1
diff -u -b -r1.533 -r1.533.2.1
--- server/sprite_instance.cpp  8 May 2008 08:10:51 -0000       1.533
+++ server/sprite_instance.cpp  16 May 2008 11:04:23 -0000      1.533.2.1
@@ -4107,6 +4107,32 @@
   _vm.getRoot().set_background_color(color);
 }
 
+static bool isTextFieldUnloaded(boost::intrusive_ptr< edit_text_character >& p)
+{
+       return p->isUnloaded();
+}
+
+/*private*/
+void
+sprite_instance::cleanup_textfield_variables()
+{
+  // nothing to do
+  if ( ! _text_variables.get() ) return;
+
+  TextFieldMap& m = *_text_variables;
+
+  for (TextFieldMap::iterator i=m.begin(), ie=m.end(); i!=ie; ++i)
+  {
+    TextFieldPtrVect& v=i->second;
+    TextFieldPtrVect::iterator lastValid = std::remove_if(v.begin(), v.end(), 
boost::bind(isTextFieldUnloaded, _1));
+    v.erase(lastValid, v.end());
+    // TODO: remove the map element if vector is empty
+    //if ( v.empty() )
+    //{
+    //}
+  }
+}
+
 
 /* public */
 void
@@ -4714,6 +4740,8 @@
 {
         //log_debug("%s.cleanDisplayList() called, current dlist is %p", 
getTarget(), (void*)&m_display_list);
   m_display_list.removeUnloaded();
+
+        cleanup_textfield_variables();
 }
 
 #ifdef GNASH_USE_GC
@@ -4749,6 +4777,19 @@
       const TextFieldPtrVect& tfs=i->second;
       for (TextFieldPtrVect::const_iterator j=tfs.begin(), je=tfs.end(); 
j!=je; ++j)
       {
+        if ( (*j)->isUnloaded() )
+       {
+          // NOTE: cleanup_display_list should have cleared these up on 
::cleanupDisplayList.
+          //       I guess if we get more might be due to ::destroy calls 
happening after
+          //       our own ::cleanupDisplayList call. Should be ok to postpone 
cleanup
+          //       on next ::advance, or we should cleanup here (locally) 
altought we're
+          //       a 'const' method...
+          //       Yet another approach would be for TextField::unload to 
unregister
+          //       self from our map, but TextField (edit_text_character) 
doesn't really
+          //       store a pointer to the sprite it's registered against.
+          //
+          log_debug("Unloaded TextField in registered textfield variables 
container on ::markReachableResources");
+       }
         (*j)->setReachable();
       }
     }

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.196
retrieving revision 1.196.2.1
diff -u -b -r1.196 -r1.196.2.1
--- server/sprite_instance.h    8 May 2008 08:21:29 -0000       1.196
+++ server/sprite_instance.h    16 May 2008 11:04:25 -0000      1.196.2.1
@@ -958,6 +958,9 @@
        ///
        TextFieldPtrVect* get_textfield_variable(const std::string& name);
 
+       /// Unregister textfield variables bound to unloaded TextFields
+       void cleanup_textfield_variables();
+
        /// soundid for current playing stream. If no stream set to -1
        int m_sound_stream_id;
 




reply via email to

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