瀏覽代碼

Merge pull request #74511 from AThousandShips/win_cursor_fix

Fix clearing custom cursor
Rémi Verschelde 2 年之前
父節點
當前提交
356a602186

+ 2 - 2
platform/linuxbsd/x11/display_server_x11.cpp

@@ -2856,11 +2856,11 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu
 			cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_img[p_shape]);
 			cursors[p_shape] = XcursorImageLoadCursor(x11_display, cursor_img[p_shape]);
 		}
 		}
 
 
+		cursors_cache.erase(p_shape);
+
 		CursorShape c = current_cursor;
 		CursorShape c = current_cursor;
 		current_cursor = CURSOR_MAX;
 		current_cursor = CURSOR_MAX;
 		cursor_set_shape(c);
 		cursor_set_shape(c);
-
-		cursors_cache.erase(p_shape);
 	}
 	}
 }
 }
 
 

+ 2 - 2
platform/macos/display_server_macos.mm

@@ -3415,9 +3415,9 @@ void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor,
 			cursors[p_shape] = nullptr;
 			cursors[p_shape] = nullptr;
 		}
 		}
 
 
-		cursor_update_shape();
-
 		cursors_cache.erase(p_shape);
 		cursors_cache.erase(p_shape);
+
+		cursor_update_shape();
 	}
 	}
 }
 }
 
 

+ 2 - 2
platform/windows/display_server_windows.cpp

@@ -1907,11 +1907,11 @@ void DisplayServerWindows::cursor_set_custom_image(const Ref<Resource> &p_cursor
 		}
 		}
 		cursors[p_shape] = nullptr;
 		cursors[p_shape] = nullptr;
 
 
+		cursors_cache.erase(p_shape);
+
 		CursorShape c = cursor_shape;
 		CursorShape c = cursor_shape;
 		cursor_shape = CURSOR_MAX;
 		cursor_shape = CURSOR_MAX;
 		cursor_set_shape(c);
 		cursor_set_shape(c);
-
-		cursors_cache.erase(p_shape);
 	}
 	}
 }
 }