CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/08/06 03:30:19
Modified files: . : ChangeLog server : DynamicShape.cpp server/parser : character_def.h shape_character_def.cpp shape_character_def.h Log message: * server/parser/character_def.h: provide a protected copy constructor resetting the render_cache_manager to NULL in the copy, to avoid multiple destruction of the same object. Add private and aborting assignment operator. Fixes bug #20694. * server/parser/shape_character_def.{cpp,h}: implement copy constructor. Add private and aborting assignment operator. Deprecate input/output cache methods and data. * server/DynamicShape.cpp: update after deprecation of cache data for input/output stuff. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3951&r2=1.3952 http://cvs.savannah.gnu.org/viewcvs/gnash/server/DynamicShape.cpp?cvsroot=gnash&r1=1.8&r2=1.9 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/character_def.h?cvsroot=gnash&r1=1.14&r2=1.15 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.cpp?cvsroot=gnash&r1=1.30&r2=1.31 http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/shape_character_def.h?cvsroot=gnash&r1=1.13&r2=1.14 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3951 retrieving revision 1.3952 diff -u -b -r1.3951 -r1.3952 --- ChangeLog 5 Aug 2007 19:29:36 -0000 1.3951 +++ ChangeLog 6 Aug 2007 03:30:17 -0000 1.3952 @@ -1,5 +1,17 @@ 2007-08-05 Sandro Santilli <[EMAIL PROTECTED]> + * server/parser/character_def.h: provide a protected copy constructor + resetting the render_cache_manager to NULL in the copy, to avoid + multiple destruction of the same object. Add private and aborting + assignment operator. Fixes bug #20694. + * server/parser/shape_character_def.{cpp,h}: implement copy + constructor. Add private and aborting assignment operator. + Deprecate input/output cache methods and data. + * server/DynamicShape.cpp: update after deprecation of cache + data for input/output stuff. + +2007-08-05 Sandro Santilli <[EMAIL PROTECTED]> + * server/vm/VM.h: make gnash buildable with GC unused. 2007-08-05 Zou Lunkai <[EMAIL PROTECTED]> Index: server/DynamicShape.cpp =================================================================== RCS file: /sources/gnash/gnash/server/DynamicShape.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -b -r1.8 -r1.9 --- server/DynamicShape.cpp 1 Jul 2007 10:54:18 -0000 1.8 +++ server/DynamicShape.cpp 6 Aug 2007 03:30:18 -0000 1.9 @@ -17,7 +17,7 @@ -/* $Id: DynamicShape.cpp,v 1.8 2007/07/01 10:54:18 bjacques Exp $ */ +/* $Id: DynamicShape.cpp,v 1.9 2007/08/06 03:30:18 strk Exp $ */ #include "DynamicShape.h" @@ -41,7 +41,7 @@ void DynamicShape::clear() { - clear_meshes(); + //clear_meshes(); m_paths.clear(); m_fill_styles.clear(); m_line_styles.clear(); Index: server/parser/character_def.h =================================================================== RCS file: /sources/gnash/gnash/server/parser/character_def.h,v retrieving revision 1.14 retrieving revision 1.15 diff -u -b -r1.14 -r1.15 --- server/parser/character_def.h 3 Jul 2007 05:46:03 -0000 1.14 +++ server/parser/character_def.h 6 Aug 2007 03:30:19 -0000 1.15 @@ -53,6 +53,8 @@ private: int m_id; + // don't assign-to + character_def& operator= (const character_def&) { abort(); return *this; } public: character_def() : @@ -61,6 +63,7 @@ { } + virtual ~character_def(); virtual void display(character* /*instance_info*/) @@ -125,6 +128,38 @@ /// render_cache_manager* m_render_cache; +protected: + + /// Copy a character definition + // + /// The copy will have a NULL render cache object. + /// The only known use of copy constructor is from + /// duplicateMovieClip, in particular during copy + /// of the drawable object, which is a subclass + /// of a shape_character_def + /// + /// The choice of NOT copying the cache manager + /// is a choice of simplicity. We can't copy the + /// pointer as the character_def destructor will + /// destroy it, and we don't want to destroy it twice. + /// We don't want to make a copy of the whole cache + /// as it might be a waste of resource, we don't want + /// to share ownership as some character_def ended up + /// NOT being immutable any more !! :( + /// + /// By setting the cache to NULL we'll leave reconstruction + /// of a cache to the renderers. + /// + /// TODO: improve by implementing copy on write for the cache ? + /// + character_def(const character_def& o) + : + resource(), // this is a new resource, nothing to copy + m_id(o.m_id), + m_render_cache(NULL) + {} + + }; Index: server/parser/shape_character_def.cpp =================================================================== RCS file: /sources/gnash/gnash/server/parser/shape_character_def.cpp,v retrieving revision 1.30 retrieving revision 1.31 diff -u -b -r1.30 -r1.31 --- server/parser/shape_character_def.cpp 1 Jul 2007 10:54:34 -0000 1.30 +++ server/parser/shape_character_def.cpp 6 Aug 2007 03:30:19 -0000 1.31 @@ -17,7 +17,7 @@ // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA // -/* $Id: shape_character_def.cpp,v 1.30 2007/07/01 10:54:34 bjacques Exp $ */ +/* $Id: shape_character_def.cpp,v 1.31 2007/08/06 03:30:19 strk Exp $ */ // Based on the public domain shape.cpp of Thatcher Ulrich <[EMAIL PROTECTED]> 2003 @@ -145,27 +145,31 @@ shape_character_def::shape_character_def() : + character_def(), m_fill_styles(), m_line_styles(), m_paths(), - m_bound(), - m_cached_meshes() + m_bound() + //,m_cached_meshes() { } - -void -shape_character_def::clear_meshes() +shape_character_def::shape_character_def(const shape_character_def& o) + : + character_def(o), + tesselate::tesselating_shape(o), + m_fill_styles(o.m_fill_styles), + m_line_styles(o.m_line_styles), + m_paths(o.m_paths), + m_bound(o.m_bound) + //,m_cached_meshes() { - // Free our mesh_sets. - for (unsigned int i = 0; i < m_cached_meshes.size(); i++) { - delete m_cached_meshes[i]; - } } + shape_character_def::~shape_character_def() { - clear_meshes(); + //clear_meshes(); } @@ -796,6 +800,17 @@ } +#if 0 // deprecated + +void +shape_character_def::clear_meshes() +{ + // Free our mesh_sets. + for (unsigned int i = 0; i < m_cached_meshes.size(); i++) { + delete m_cached_meshes[i]; + } +} + void shape_character_def::output_cached_data(tu_file* out, const cache_options& /* options */) // Dump our precomputed mesh data to the given stream. { @@ -822,6 +837,8 @@ } } +#endif // deprecated cached data + #ifdef GNASH_USE_GC void shape_character_def::markReachableResources() const Index: server/parser/shape_character_def.h =================================================================== RCS file: /sources/gnash/gnash/server/parser/shape_character_def.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -b -r1.13 -r1.14 --- server/parser/shape_character_def.h 20 Jun 2007 14:23:50 -0000 1.13 +++ server/parser/shape_character_def.h 6 Aug 2007 03:30:19 -0000 1.14 @@ -5,7 +5,7 @@ // Quadratic bezier outline shapes, the basis for most SWF rendering. -/* $Id: shape_character_def.h,v 1.13 2007/06/20 14:23:50 strk Exp $ */ +/* $Id: shape_character_def.h,v 1.14 2007/08/06 03:30:19 strk Exp $ */ #ifndef GNASH_SHAPE_CHARACTER_DEF_H #define GNASH_SHAPE_CHARACTER_DEF_H @@ -27,6 +27,10 @@ /// \brief /// Represents the outline of one or more shapes, along with /// information on fill and line styles. + // + /// Inheritance from tesselating_shape is only needed to expose a known interface + /// for mesh_set class use. + /// class shape_character_def : public character_def, public tesselate::tesselating_shape { public: @@ -59,8 +63,9 @@ /// Compute bounds by looking at the component paths void compute_bound(rect* r) const; - void output_cached_data(tu_file* out, const cache_options& options); - void input_cached_data(tu_file* in); + // deprecated + //void output_cached_data(tu_file* out, const cache_options& options); + //void input_cached_data(tu_file* in); const FillStyleVect& get_fill_styles() const { return m_fill_styles; } const LineStyleVect& get_line_styles() const { return m_line_styles; } @@ -89,8 +94,11 @@ PathVect m_paths; rect m_bound; - /// Free all meshes - void clear_meshes(); + /// Free all meshes (deprecated) + //void clear_meshes(); + + /// Copy a shape character definition + shape_character_def(const shape_character_def& o); private: @@ -106,9 +114,15 @@ void sort_and_clean_meshes() const; + // Don't assign to a shape character definition + shape_character_def& operator= (const shape_character_def&) + { + abort(); + return *this; + } - // Cached pre-tesselated meshes. - mutable std::vector<mesh_set*> m_cached_meshes; + // Cached pre-tesselated meshes. (deprecated) + //mutable std::vector<mesh_set*> m_cached_meshes; }; } // end namespace gnash _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit