summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2006-04-20 03:11:47 +0000
committerMatthias Melcher <fltk@matthiasm.com>2006-04-20 03:11:47 +0000
commitafbe855296cad110275541a1c660f8f005122a42 (patch)
treeea892e5b17b542d761d784232008719a29f5afbc /src
parent9460fcc375240a3e98b0ee65909fbdefe11909ae (diff)
STR #1231: moved clearing of resources out of Fl::run() into a static class destructor. Although this should work, I was unable to test this (no Windows machine at this time). Also, since the order in which static destructors are called is undefined, this code can still lead to a crash if the main window was alos statically allocate in global space. Suggestions welcome.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5004 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src')
-rw-r--r--src/Fl.cxx23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx
index 17967a783..accd7c6b0 100644
--- a/src/Fl.cxx
+++ b/src/Fl.cxx
@@ -355,16 +355,25 @@ double Fl::wait(double time_to_wait) {
int Fl::run() {
while (Fl_X::first) wait(FOREVER);
-#ifdef WIN32
- fl_free_fonts(); // do some WIN32 cleanup
- fl_cleanup_pens();
- OleUninitialize();
- fl_brush_action(1);
- fl_cleanup_dc_list();
-#endif
return 0;
}
+#ifdef WIN32
+class Fl_Win32_At_Exit {
+ Fl_Win32_At_Exit() { }
+ ~Fl_Win32_At_Exit() {
+ fl_free_fonts(); // do some WIN32 cleanup
+ fl_cleanup_pens();
+ OleUninitialize();
+ fl_brush_action(1);
+ fl_cleanup_dc_list();
+ }
+};
+static Fl_Win32_At_Exit win32_at_exit;
+#endif
+
+
+
int Fl::wait() {
if (!Fl_X::first) return 0;
wait(FOREVER);