summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx6
-rw-r--r--src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx8
2 files changed, 9 insertions, 5 deletions
diff --git a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
index ab416b134..fdff2fe1b 100644
--- a/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
+++ b/src/drivers/GDI/Fl_GDI_Graphics_Driver_rect.cxx
@@ -243,8 +243,10 @@ void Fl_GDI_Graphics_Driver::pop_clip() {
void Fl_GDI_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
- Fl_Region r = rstack[rstackptr];
- SelectClipRgn(gc_, r); //if r is NULL, clip is automatically cleared
+ if (gc_) {
+ Fl_Region r = rstack[rstackptr];
+ SelectClipRgn(gc_, r); // if r is NULL, clip is automatically cleared
+ }
}
diff --git a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
index c6ca9b674..2d239cc0e 100644
--- a/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
+++ b/src/drivers/Xlib/Fl_Xlib_Graphics_Driver_rect.cxx
@@ -339,9 +339,11 @@ void Fl_Xlib_Graphics_Driver::pop_clip() {
void Fl_Xlib_Graphics_Driver::restore_clip() {
fl_clip_state_number++;
- Fl_Region r = rstack[rstackptr];
- if (r) XSetRegion(fl_display, gc_, r);
- else XSetClipMask(fl_display, gc_, 0);
+ if (gc_) {
+ Fl_Region r = rstack[rstackptr];
+ if (r) XSetRegion(fl_display, gc_, r);
+ else XSetClipMask(fl_display, gc_, 0);
+ }
}
#endif // FL_CFG_GFX_XLIB_RECT_CXX