-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Window minimize crash fix: #37327 #37382
Window minimize crash fix: #37327 #37382
Conversation
@@ -1093,6 +1093,7 @@ bool DisplayServerWindows::can_any_window_draw() const { | |||
_THREAD_SAFE_METHOD_ | |||
|
|||
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) { | |||
if (E->key() == -1) continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be INVALID_WINDOW_ID
(which is -1
) instead of -1
.
Probably there's missing check for INVALID_WINDOW_ID
somewhere in the window creation, AFAIK it should not be in the map.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some missing checks I found:
godot/platform/windows/display_server_windows.cpp
Lines 498 to 500 in d2d359d
WindowID window_id = _create_window(p_mode, p_flags, p_rect); | |
WindowData &wd = windows[window_id]; |
_create_window
can return -1
godot/platform/windows/display_server_windows.cpp
Lines 1788 to 1795 in d2d359d
WindowID window_id = INVALID_WINDOW_ID; | |
for (Map<WindowID, WindowData>::Element *E = windows.front(); E; E = E->next()) { | |
if (E->get().hWnd == hWnd) { | |
window_id = E->key(); | |
break; | |
} | |
} |
Can potentially use -1 if window is not in the map (window is created but not added to the map, or removed from the map but still closing, not sure if any of this is possible).
61f811a
to
4ca4f39
Compare
Fix does not look correct, I have the feeling the problem is the creation flags for the minimized window.. |
You should catch it in the WndProc function with
godot/platform/windows/display_server_windows.cpp Line 1806 in d29514a |
@reduz @HaSa1002 I actually think this PR is correct. There are no windows creation flags for Vulkan, seen here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkWin32SurfaceCreateFlagsKHR.html Also, according to here: https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VkWin32SurfaceCreateFlagsKHR
which the code does, it sees windows size being 0,0 and returns. But there is no code for handling a nullptr swapchain further up. |
The original issue is already fixed. Thanks for the contribution nonetheless. |
Fix: #37327