소스 검색

Merge pull request #69277 from pkdawson/construct-joypad-first

[Windows] Fix joypad crash
Rémi Verschelde 2 년 전
부모
커밋
be0923b1d9
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      platform/windows/display_server_windows.cpp

+ 2 - 2
platform/windows/display_server_windows.cpp

@@ -3919,6 +3919,8 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
 	WindowID main_window = _create_window(p_mode, p_vsync_mode, 0, Rect2i(window_position, p_resolution));
 	ERR_FAIL_COND_MSG(main_window == INVALID_WINDOW_ID, "Failed to create main window.");
 
+	joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd);
+
 	for (int i = 0; i < WINDOW_FLAG_MAX; i++) {
 		if (p_flags & (1 << i)) {
 			window_set_flag(WindowFlags(i), true, main_window);
@@ -3958,8 +3960,6 @@ DisplayServerWindows::DisplayServerWindows(const String &p_rendering_driver, Win
 
 	_update_real_mouse_position(MAIN_WINDOW_ID);
 
-	joypad = new JoypadWindows(&windows[MAIN_WINDOW_ID].hWnd);
-
 	r_error = OK;
 
 	static_cast<OS_Windows *>(OS::get_singleton())->set_main_window(windows[MAIN_WINDOW_ID].hWnd);