Skip to content

Commit

Permalink
Merge pull request #73239 from bruvzg/cleanup_callback
Browse files Browse the repository at this point in the history
Cleanup Window callbacks before destroying in to avoid callback calls with invalid object.
  • Loading branch information
akien-mga authored Feb 13, 2023
2 parents 3815903 + a000c64 commit 854d9c3
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions scene/main/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,12 @@ void Window::_update_from_window() {
void Window::_clear_window() {
ERR_FAIL_COND(window_id == DisplayServer::INVALID_WINDOW_ID);

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

0 comments on commit 854d9c3

Please sign in to comment.