From ef952dfa5366cb4c7a7109b63629ea02a7fc576d Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Fri, 7 Feb 2014 00:09:52 +0000 Subject: Fix crash when Fl_Window::flush() is called before show() (STR #3028). The fix is twofold: (1) if Fl_Window::flush() is called, this is ignored silently (2) if Fl_Window::make_current() is called directly, but the window is currently not shown(), then the program will be terminated with an error message. The latter is necessary because returning from make_current() would leave the program in a state where it would expect to have a valid drawing context. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10095 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_x.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/Fl_x.cxx') diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx index e1831b5c4..22acff7e9 100644 --- a/src/Fl_x.cxx +++ b/src/Fl_x.cxx @@ -34,6 +34,7 @@ # include # include # include +# include # include # include # include "flstring.h" @@ -2339,6 +2340,10 @@ GC fl_gc; // make X drawing go into this window (called by subclass flush() impl.) void Fl_Window::make_current() { static GC gc; // the GC used by all X windows + if (!shown()) { + fl_alert("Fl_Window::make_current(), but window is not shown()."); + Fl::fatal("Fl_Window::make_current(), but window is not shown()."); + } if (!gc) gc = XCreateGC(fl_display, i->xid, 0, 0); fl_window = i->xid; fl_gc = gc; -- cgit v1.2.3