summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlbrecht Schlosser <albrechts.fltk@online.de>2021-11-09 19:36:26 +0100
committerAlbrecht Schlosser <albrechts.fltk@online.de>2021-11-09 19:36:26 +0100
commit5c5244b1622561809173cbfc41fa9c1290d55fe2 (patch)
treebdcffad8278e87266c018112eece18dfd8a805ca
parent5e7eede311d3993e1ced6207e09de14a6ecee9a8 (diff)
Fix a fluid crash when writing a template screenshot
We need to show() the window before we call fl_read_image() if it is not shown yet, otherwise fluid would crash.
-rw-r--r--fluid/Fl_Window_Type.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx
index 8f0f39dc1..62ed479f8 100644
--- a/fluid/Fl_Window_Type.cxx
+++ b/fluid/Fl_Window_Type.cxx
@@ -425,8 +425,14 @@ void Fl_Window_Type::open() {
uchar *Fl_Window_Type::read_image(int &ww, int &hh) {
Overlay_Window *w = (Overlay_Window *)o;
+ int hidden = !w->shown();
+ w->show(); // make it the front window
+
// Read the screen image...
- return (w->read_image(ww, hh));
+ uchar *idata = w->read_image(ww, hh);
+ if (hidden)
+ w->hide();
+ return idata;
}