mirror of https://github.com/fltk/fltk
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
This commit is contained in:
parent
9460fcc375
commit
afbe855296
23
src/Fl.cxx
23
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);
|
||||
|
|
Loading…
Reference in New Issue