diff src/ov-base.h @ 14013:1734ebe27134

move onCleanup function and class to liboctinterp * ov-oncleanup.h, ov-oncleanup.cc: Move onCleanup class and function here. * onCleanup.cc: From here. * DLD-FUNCTIONS/module-list: Delete onCleanup.cc from the list. * src/Makefile.am (OV_INCLUDES): Add ov-oncleanup.h to the list. (OV_SRC): add ov-oncleanup.cc to the list. * ov.cc (register_types): Register octave_oncleanup here. * ov-typeinfo.cc (octave_value_typeinfo::instance_ok): Do register cleanup function.
author John W. Eaton <jwe@octave.org>
date Thu, 08 Dec 2011 00:52:39 -0500
parents 2a8dcb5b3a00
children 72c96de7a403
line wrap: on
line diff
--- a/src/ov-base.h	Thu Dec 08 00:49:51 2011 -0500
+++ b/src/ov-base.h	Thu Dec 08 00:52:39 2011 -0500
@@ -167,9 +167,9 @@
   const std::string t::c_name (c); \
   void t::register_type (void) \
     { \
-      t_id = octave_value_typeinfo::register_type (t::t_name, \
-                                                   t::c_name, \
-                                                   octave_value (new t ())); \
+      static t exemplar; \
+      octave_value v (&exemplar, true); \
+      t_id = octave_value_typeinfo::register_type (t::t_name, t::c_name, v); \
     }
 
 // A base value type, so that derived types only have to redefine what