Wayland: add test to avoid null pointer dereferencing

This commit is contained in:
ManoloFLTK 2023-07-31 19:26:37 +02:00
parent 7feddabd24
commit e12eb99b5d
2 changed files with 5 additions and 4 deletions

View File

@ -306,9 +306,10 @@ The \c wl_display_dispatch() call is repeated as long as data are available for
The event loop is run by function \c Fl_Unix_System_Driver::wait() which is used by both
the Wayland and X11 FLTK backends. Among various tasks, this function waits for data arriving
on the file descriptors FLTK is listening. Overall, the event loop of the Wayland backend
is nearly exactly the
same as that used by the X11 backend. The Wayland backend differs only in the callback function
called to handle data read from the Wayland connection socket, which is Wayland-specific.
is nearly exactly the same as that used by the X11 backend. The Wayland backend differs
only in the callback function handling data read from the Wayland connection socket,
and in overridden functions \c Fl_Wayland_Screen_Driver::poll_or_select_with_delay() and
\c Fl_Wayland_Screen_Driver::poll_or_select().
\section wayland-surface Wayland windows and surfaces

View File

@ -1341,7 +1341,7 @@ void Fl_Wayland_Window_Driver::makeWindow()
if (pWindow->modal() || pWindow->non_modal()) {
if (pWindow->modal()) Fl::modal_ = pWindow;
if (new_window->kind == DECORATED && first_xid && first_xid->kind == DECORATED) {
libdecor_frame_set_parent(new_window->frame, first_xid->frame);
if (first_xid->frame) libdecor_frame_set_parent(new_window->frame, first_xid->frame);
} else if (new_window->kind == UNFRAMED && new_window->xdg_toplevel && first_xid) {
Fl_Wayland_Window_Driver *top_dr = Fl_Wayland_Window_Driver::driver(first_xid->fl_win);
if (top_dr->xdg_toplevel()) xdg_toplevel_set_parent(new_window->xdg_toplevel,