mirror of
https://github.com/fltk/fltk.git
synced 2026-06-06 00:22:42 +08:00
Restore the possibility to construct FLTK objects and draw them within static initializers
(which run before main() begins in an uncontrolled order). This was failing because calls to drawing functions (e.g., fl_font(f,s);) crashed due to uninitialized fl_graphics_driver global variable. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10959 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -141,6 +141,11 @@ Fl_Widget::Fl_Widget(int X, int Y, int W, int H, const char* L) {
|
||||
|
||||
parent_ = 0;
|
||||
if (Fl_Group::current()) Fl_Group::current()->add(this);
|
||||
static int been_here = 0;
|
||||
if (!been_here) {
|
||||
been_here = 1;
|
||||
Fl_Display_Device::display_device(); // make sure fl_graphics_driver is initialized
|
||||
}
|
||||
}
|
||||
|
||||
void Fl_Widget::resize(int X, int Y, int W, int H) {
|
||||
|
||||
Reference in New Issue
Block a user