From 6097c134d893c67aa6d3d56ee176531c481261a8 Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Wed, 24 Feb 2016 08:07:30 +0000 Subject: Avoid static initializers to allow FLTK usage in static initializers. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11213 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- FL/Fl.H | 2 +- src/Fl.cxx | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/FL/Fl.H b/FL/Fl.H index 5df4b4410..3d33fba7a 100644 --- a/FL/Fl.H +++ b/FL/Fl.H @@ -46,6 +46,7 @@ class Fl_Widget; class Fl_Window; class Fl_Image; struct Fl_Label; +class Fl_Screen_Driver; // Keep avoiding having the socket deps at that level but mke sure it will work in both 32 & 64 bit builds #if defined(WIN32) && !defined(__CYGWIN__) @@ -137,7 +138,6 @@ class FL_EXPORT Fl { private: - static class Fl_Screen_Driver *screen_driver_; static int use_high_res_GL_; public: diff --git a/src/Fl.cxx b/src/Fl.cxx index c0120b13d..a27a187fd 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -216,16 +216,12 @@ char const * const Fl::clipboard_image = "image"; // Drivers // -Fl_Screen_Driver *Fl::screen_driver_ = Fl_Screen_Driver::newScreenDriver(); - Fl_Screen_Driver *Fl::screen_driver() { - if (!screen_driver_) - screen_driver_ = Fl_Screen_Driver::newScreenDriver(); + static Fl_Screen_Driver* screen_driver_ = Fl_Screen_Driver::newScreenDriver(); return screen_driver_; } - // // 'Fl::version()' - Return the API version number... // -- cgit v1.2.3