Author: AlbrechtS
Date: 2011-05-21 03:05:19 -0700 (Sat, 21 May 2011)
New Revision: 8706
Log:
Fix potential crash in fl_xid() on Linux (STR #2635). This would
crash if called when a window is not shown().


Modified:
   branches/branch-1.3/CHANGES
   branches/branch-1.3/FL/x.H
   branches/branch-1.3/src/Fl_x.cxx

Modified: branches/branch-1.3/CHANGES
===================================================================
--- branches/branch-1.3/CHANGES 2011-05-20 22:47:11 UTC (rev 8705)
+++ branches/branch-1.3/CHANGES 2011-05-21 10:05:19 UTC (rev 8706)
@@ -146,6 +146,7 @@
 
          Bug Fixes
 
+       - Fixed potential crash in fl_xid() on Linux (STR #2635)
        - Fixed keyboard navigation in fl_choice() (STR #2591)
        - Fixed alpha blending under X11 when line data size != 0 (STR #2606)
        - Fixed Fl_Tabs selection border drawing, if tabs are at the bottom

Modified: branches/branch-1.3/FL/x.H
===================================================================
--- branches/branch-1.3/FL/x.H  2011-05-20 22:47:11 UTC (rev 8705)
+++ branches/branch-1.3/FL/x.H  2011-05-21 10:05:19 UTC (rev 8706)
@@ -174,7 +174,7 @@
 extern FL_EXPORT char fl_override_redirect; // hack into Fl_X::make_xid()
 extern FL_EXPORT int fl_background_pixel;  // hack into Fl_X::make_xid()
 
-inline Window fl_xid(const Fl_Window* w) { return Fl_X::i(w)->xid; }
+inline Window fl_xid(const Fl_Window* w) { Fl_X *temp = Fl_X::i(w); return 
temp ? temp->xid : 0; }
 
 #else
 

Modified: branches/branch-1.3/src/Fl_x.cxx
===================================================================
--- branches/branch-1.3/src/Fl_x.cxx    2011-05-20 22:47:11 UTC (rev 8705)
+++ branches/branch-1.3/src/Fl_x.cxx    2011-05-21 10:05:19 UTC (rev 8706)
@@ -1902,12 +1902,11 @@
 #endif
 }
 
-Window fl_xid_(const Fl_Window* w)
-{
-  return Fl_X::i(w)->xid;
+Window fl_xid_(const Fl_Window *w) {
+  Fl_X *temp = Fl_X::i(w);
+  return temp ? temp->xid : 0;
 }
 
-
 int Fl_Window::decorated_h()
 {
   if (parent() || !shown()) return h();

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to