File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,9 @@ int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
163163
164164 now = SDL_GetTicks ();
165165 if (SDL_TICKS_PASSED (now , max_wait )) {
166- if (!WAYLAND_wl_display_cancel_read ) {
166+ /* If wl_display_prepare_read_queue is not called, we must not call wl_display_cancel_read().
167+ Doing so would decrement wl_display->reader_count to -1, causing a deadlock. */
168+ if (!WAYLAND_wl_display_cancel_read || !WAYLAND_wl_display_prepare_read_queue || !data -> gles_swap_frame_event_queue ) {
167169 break ;
168170 }
169171 /* Timeout expired. Cancel the read. */
@@ -172,7 +174,9 @@ int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window)
172174 }
173175
174176 if (SDL_IOReady (WAYLAND_wl_display_get_fd (display ), SDL_IOR_READ , max_wait - now ) <= 0 ) {
175- if (!WAYLAND_wl_display_cancel_read ) {
177+ /* If wl_display_prepare_read_queue is not called, we must not call wl_display_cancel_read().
178+ Doing so would decrement wl_display->reader_count to -1, causing a deadlock. */
179+ if (!WAYLAND_wl_display_cancel_read || !WAYLAND_wl_display_prepare_read_queue || !data -> gles_swap_frame_event_queue ) {
176180 break ;
177181 }
178182 /* Error or timeout expired without any events for us. Cancel the read. */
You can’t perform that action at this time.
0 commit comments