diff src/graphics.h.in @ 13992:e1f76bfe0452

apply singleton_cleanup to a few more classes * ft-manager.cc (ft_manager::cleanup_instance): New function. (ft_manager::instance_ok): Add instance to singleton_cleanup_list. * graphics.h.in, graphics.cc (gh_mananger::create_instance, gh_manager::cleanup_instance): New functions. (gh_manager::instance_ok): Call create_instance. * oct-errno.h (octave_errno::cleanup_instance): New function. * oct-errno.cc.in (octave_errno::instance_ok): Add instance to singleton_cleanup_list.
author John W. Eaton <jwe@octave.org>
date Sun, 04 Dec 2011 16:17:45 -0500
parents 43cc49c7abd1
children 907d03def9d5
line wrap: on
line diff
--- a/src/graphics.h.in	Sun Dec 04 15:57:58 2011 -0500
+++ b/src/graphics.h.in	Sun Dec 04 16:17:45 2011 -0500
@@ -5170,12 +5170,14 @@
 
 public:
 
+  static void create_instance (void);
+
   static bool instance_ok (void)
   {
     bool retval = true;
 
     if (! instance)
-      instance = new gh_manager ();
+      create_instance ();
 
     if (! instance)
       {
@@ -5187,6 +5189,8 @@
     return retval;
   }
 
+  static void cleanup_instance (void) { delete instance; instance = 0; }
+
   static graphics_handle get_handle (bool integer_figure_handle)
   {
     return instance_ok ()