diff src/graphics.cc @ 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 ffbbe6719ef5
children 54f76558c41a
line wrap: on
line diff
--- a/src/graphics.cc	Sun Dec 04 15:57:58 2011 -0500
+++ b/src/graphics.cc	Sun Dec 04 16:17:45 2011 -0500
@@ -36,10 +36,12 @@
 #include <string>
 #include <sstream>
 
+#include "cmd-edit.h"
 #include "file-ops.h"
 #include "file-stat.h"
-
-#include "cmd-edit.h"
+#include "oct-locbuf.h"
+#include "singleton-cleanup.h"
+
 #include "cutils.h"
 #include "defun.h"
 #include "display.h"
@@ -47,7 +49,6 @@
 #include "graphics.h"
 #include "input.h"
 #include "ov.h"
-#include "oct-locbuf.h"
 #include "oct-obj.h"
 #include "oct-map.h"
 #include "ov-fcn-handle.h"
@@ -7395,6 +7396,14 @@
   graphics_toolkit::default_toolkit ();
 }
 
+void
+gh_manager::create_instance (void)
+{
+  instance = new gh_manager ();
+
+  singleton_cleanup_list::add (cleanup_instance);
+}
+
 graphics_handle
 gh_manager::do_make_graphics_handle (const std::string& go_name,
                                      const graphics_handle& p,