summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES1
-rw-r--r--FL/x.H2
-rw-r--r--src/Fl_x.cxx7
3 files changed, 5 insertions, 5 deletions
diff --git a/CHANGES b/CHANGES
index 0d0822c68..35b81b382 100644
--- a/CHANGES
+++ b/CHANGES
@@ -146,6 +146,7 @@ CHANGES IN FLTK 1.3.0
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
diff --git a/FL/x.H b/FL/x.H
index b9be0343b..1a7a4625c 100644
--- a/FL/x.H
+++ b/FL/x.H
@@ -174,7 +174,7 @@ public:
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
diff --git a/src/Fl_x.cxx b/src/Fl_x.cxx
index 913c7200d..95aff3d3e 100644
--- a/src/Fl_x.cxx
+++ b/src/Fl_x.cxx
@@ -1902,12 +1902,11 @@ void Fl_Window::make_current() {
#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();