diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-12-21 14:22:08 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-12-21 14:22:08 +0100 |
| commit | 42ff55026e98d6ed6ebf891434afdd03b1a52e02 (patch) | |
| tree | be01f1b2f1ab927ee6c479e929c7c7b849aecf04 | |
| parent | 76a2c95f0715845432dab89984bb28a5dbfa3ebc (diff) | |
Fix "commit 96bacd3 may crash on X11" (#873)
| -rw-r--r-- | src/Fl_x.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index 07f80cde7..632101163 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -531,8 +531,8 @@ void Fl_X11_Screen_Driver::disable_im() { } void Fl_X11_Screen_Driver::open_display_platform() { - static GC gc = NULL; - if (gc) return; + static Display *d = NULL; + if (d) return; setlocale(LC_CTYPE, ""); XSetLocaleModifiers(""); @@ -540,7 +540,7 @@ void Fl_X11_Screen_Driver::open_display_platform() { XSetIOErrorHandler(io_error_handler); XSetErrorHandler(xerror_handler); - Display *d = (fl_display ? fl_display : XOpenDisplay(0)); + d = (fl_display ? fl_display : XOpenDisplay(0)); if (!d) { Fl::fatal("Can't open display: %s", XDisplayName(0)); // does not return return; // silence static code analyzer @@ -548,7 +548,7 @@ void Fl_X11_Screen_Driver::open_display_platform() { open_display_i(d); // the unique GC used by all X windows - gc = XCreateGC(fl_display, RootWindow(fl_display, fl_screen), 0, 0); + GC gc = XCreateGC(fl_display, RootWindow(fl_display, fl_screen), 0, 0); Fl_Graphics_Driver::default_driver().gc(gc); fl_create_print_window(); } |
