From 1a40cda95e4323b38facba4376944a1eceafd39e Mon Sep 17 00:00:00 2001 From: bruvzg <7645683+bruvzg@users.noreply.github.com> Date: Tue, 28 May 2024 09:41:04 +0300 Subject: [PATCH] [macOS, X11] Fix duplicate close requests. --- platform/linuxbsd/x11/display_server_x11.cpp | 5 ++++- platform/macos/display_server_macos.mm | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp index 2c07acf94f73..feb2f48101dd 100644 --- a/platform/linuxbsd/x11/display_server_x11.cpp +++ b/platform/linuxbsd/x11/display_server_x11.cpp @@ -4206,7 +4206,10 @@ void DisplayServerX11::popup_close(WindowID p_window) { WindowID win_id = E->get(); popup_list.erase(E); - _send_window_event(windows[win_id], DisplayServerX11::WINDOW_EVENT_CLOSE_REQUEST); + if (win_id != p_window) { + // Only request close on related windows, not this window. We are already processing it. + _send_window_event(windows[win_id], DisplayServerX11::WINDOW_EVENT_CLOSE_REQUEST); + } E = F; } } diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index db71c48eff38..3c94aa01087f 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -3448,7 +3448,10 @@ WindowID win_id = E->get(); popup_list.erase(E); - send_window_event(windows[win_id], DisplayServerMacOS::WINDOW_EVENT_CLOSE_REQUEST); + if (win_id != p_window) { + // Only request close on related windows, not this window. We are already processing it. + send_window_event(windows[win_id], DisplayServerMacOS::WINDOW_EVENT_CLOSE_REQUEST); + } E = F; } if (!was_empty && popup_list.is_empty()) {