Fix "Wayland: NULL pointer dereference in Fl::cairo_make_current()" (#1359)

This commit is contained in:
ManoloFLTK 2026-01-11 12:09:41 +01:00 committed by Albrecht Schlosser
parent 82399ebe4b
commit 07cce04aa1

View File

@ -105,8 +105,8 @@ cairo_t *Fl::cairo_make_current(Fl_Window *wi) {
#if defined(FLTK_USE_WAYLAND) #if defined(FLTK_USE_WAYLAND)
if (fl_wl_display()) { // true means using wayland backend if (fl_wl_display()) { // true means using wayland backend
struct wld_window *xid = fl_wl_xid(wi); struct wld_window *xid = fl_wl_xid(wi);
if (!xid->buffer) if (!xid || !xid->buffer)
return NULL; // this may happen with GL windows return NULL; // this may happen with GL windows or if window is not shown
cairo_ctxt = xid->buffer->draw_buffer.cairo_; cairo_ctxt = xid->buffer->draw_buffer.cairo_;
cairo_state_.cc(cairo_ctxt, false); cairo_state_.cc(cairo_ctxt, false);
return cairo_ctxt; return cairo_ctxt;