Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash on Windows when closing Window #80142

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions platform/linuxbsd/x11/display_server_x11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,12 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {

DEBUG_LOG_X11("delete_sub_window: %lu (%u) \n", wd.x11_window, p_id);

window_set_rect_changed_callback(Callable(), p_id);
window_set_window_event_callback(Callable(), p_id);
window_set_input_event_callback(Callable(), p_id);
window_set_input_text_callback(Callable(), p_id);
window_set_drop_files_callback(Callable(), p_id);

while (wd.transient_children.size()) {
window_set_transient(*wd.transient_children.begin(), INVALID_WINDOW_ID);
}
Expand Down
4 changes: 4 additions & 0 deletions platform/windows/display_server_windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3838,6 +3838,10 @@ LRESULT DisplayServerWindows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARA
} break;
case WM_DESTROY: {
Input::get_singleton()->flush_buffered_events();
if (window_mouseover_id == window_id) {
window_mouseover_id = INVALID_WINDOW_ID;
_send_window_event(windows[window_id], WINDOW_EVENT_MOUSE_EXIT);
}
} break;
case WM_SETCURSOR: {
if (LOWORD(lParam) == HTCLIENT) {
Expand Down
6 changes: 0 additions & 6 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -618,12 +618,6 @@ void Window::_clear_window() {

bool had_focus = has_focus();

DisplayServer::get_singleton()->window_set_rect_changed_callback(Callable(), window_id);
DisplayServer::get_singleton()->window_set_window_event_callback(Callable(), window_id);
DisplayServer::get_singleton()->window_set_input_event_callback(Callable(), window_id);
DisplayServer::get_singleton()->window_set_input_text_callback(Callable(), window_id);
DisplayServer::get_singleton()->window_set_drop_files_callback(Callable(), window_id);

if (transient_parent && transient_parent->window_id != DisplayServer::INVALID_WINDOW_ID) {
DisplayServer::get_singleton()->window_set_transient(window_id, DisplayServer::INVALID_WINDOW_ID);
}
Expand Down
Loading