FLTK logo

[master] 5c5244b - Fix a fluid crash when writing a template screenshot

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.commit  ]
 
Previous Message ]Next Message ]

[master] 5c5244b - Fix a fluid crash when writing a template screenshot "Albrecht Schlosser" Nov 09, 2021  
 
commit 5c5244b1622561809173cbfc41fa9c1290d55fe2
Author:     Albrecht Schlosser <albrechts.fltk@online.de>
AuthorDate: Tue Nov 9 19:36:26 2021 +0100
Commit:     Albrecht Schlosser <albrechts.fltk@online.de>
CommitDate: Tue Nov 9 19:36:26 2021 +0100

    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.

 fluid/Fl_Window_Type.cxx | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git fluid/Fl_Window_Type.cxx fluid/Fl_Window_Type.cxx
index 8f0f39d..62ed479 100644
--- fluid/Fl_Window_Type.cxx
+++ 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;
 }
 
 
Direct Link to Message ]
 
     
Previous Message ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.