Mercurial > hg > octave-lojdl
changeset 14016:8feb25ecddaf
close all graphics toolkits before exit
* graphics.h (graphics_toolkit::close_all_toolkits):
Move here from graphics.cc. Ensure that the toolkit is closed and
deleted properly.
* toplev.cc (clean_up_and_exit):
Call graphics_toolkit::close_all_toolkits.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 08 Dec 2011 17:22:57 -0500 |
parents | 77adde2e79ac |
children | 0b94080d2b0f |
files | src/graphics.cc src/graphics.h.in src/toplev.cc |
diffstat | 3 files changed, 19 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graphics.cc +++ b/src/graphics.cc @@ -2890,19 +2890,6 @@ return available_toolkits["gnuplot"]; } -void -graphics_toolkit::close_all_toolkits (void) -{ - while (! available_toolkits.empty ()) - { - available_toolkits_iterator p = available_toolkits.begin (); - - p->second.close (); - - available_toolkits.erase (p); - } -} - std::map<std::string, graphics_toolkit> graphics_toolkit::available_toolkits; // ---------------------------------------------------------------------
--- a/src/graphics.h.in +++ b/src/graphics.h.in @@ -2236,8 +2236,6 @@ // Close the graphics toolkit. void close (void) { rep->close (); } - void close_all_toolkits (void); - OCTINTERP_API static graphics_toolkit default_toolkit (void); static void register_toolkit (const graphics_toolkit& b) @@ -2269,6 +2267,23 @@ return m; } + static void close_all_toolkits (void) + { + while (! available_toolkits.empty ()) + { + available_toolkits_iterator p = available_toolkits.begin (); + + std::string name = p->first; + + p->second.close (); + + // The toolkit may have unregistered itself. If not, we'll do + // it here. + if (available_toolkits.find (name) != available_toolkits.end ()) + unregister_toolkit (name); + } + } + private: base_graphics_toolkit *rep;