CVSROOT: /sources/gnash Module name: gnash Changes by: Sandro Santilli <strk> 07/06/14 10:57:07
Modified files: . : ChangeLog libbase : ref_counted.h Log message: * libbase/ref_counted.h: made destructor protected, to ensure no user is explicitly deleting a ref_counted object (propedeutic to GC) CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.3540&r2=1.3541 http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/ref_counted.h?cvsroot=gnash&r1=1.5&r2=1.6 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.3540 retrieving revision 1.3541 diff -u -b -r1.3540 -r1.3541 --- ChangeLog 14 Jun 2007 09:43:17 -0000 1.3540 +++ ChangeLog 14 Jun 2007 10:57:06 -0000 1.3541 @@ -1,5 +1,8 @@ 2007-06-14 Sandro Santilli <[EMAIL PROTECTED]> + * libbase/ref_counted.h: made destructor protected, to ensure no + user is explicitly deleting a ref_counted object (propedeutic + to GC) * configure.ac: FREETYPE_{CFLAGS,LIBS} => FREETYPE2_{CFLAGS,LIBS) in final reports/checks. * testsuite/misc-mtasc.all/Makefile.am: skip all tests if Index: libbase/ref_counted.h =================================================================== RCS file: /sources/gnash/gnash/libbase/ref_counted.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- libbase/ref_counted.h 28 May 2007 15:41:02 -0000 1.5 +++ libbase/ref_counted.h 14 Jun 2007 10:57:07 -0000 1.6 @@ -15,7 +15,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -/* $Id: ref_counted.h,v 1.5 2007/05/28 15:41:02 ann Exp $ */ +/* $Id: ref_counted.h,v 1.6 2007/06/14 10:57:07 strk Exp $ */ #ifndef GNASH_REF_COUNTED_H #define GNASH_REF_COUNTED_H @@ -41,6 +41,16 @@ { private: mutable int m_ref_count; + +protected: + + // A ref-counted object only deletes self, + // must never be explicitly deleted ! + virtual ~ref_counted() + { + assert(m_ref_count == 0); + } + public: ref_counted() : @@ -48,17 +58,14 @@ { } - virtual ~ref_counted() - { - assert(m_ref_count == 0); - } - void add_ref() const { assert(m_ref_count >= 0); m_ref_count++; } - void drop_ref() const { + + void drop_ref() const + { assert(m_ref_count > 0); m_ref_count--; if (m_ref_count <= 0){ _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit