summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-03 13:02:11 +0200
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2019-10-03 13:02:11 +0200
commit5bfe32eaa4b2254b48f39bde3e7bb6055eae9b83 (patch)
treee5c6a11a4b2e558a6f466b44f223efed3a8698ea
parent09bf1b35c0310617924fc4eaca32d5b91460d492 (diff)
Properly revert cursor when using set_custom_mouse_cursor with null
Fixes #32486
-rw-r--r--platform/javascript/os_javascript.cpp2
-rw-r--r--platform/osx/os_osx.mm7
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/x11/os_x11.cpp2
4 files changed, 16 insertions, 2 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 0179bf813d..b0661cb4dd 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -574,6 +574,8 @@ void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_s
}, cursors[p_shape].utf8().get_data());
/* clang-format on */
cursors[p_shape] = "";
+
+ cursors_cache.erase(p_shape);
}
set_cursor_shape(cursor_shape);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index f48d4a307d..d30cb1c092 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -1973,11 +1973,16 @@ void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
[nsimage release];
} else {
// Reset to default system cursor
- cursors[p_shape] = NULL;
+ if (cursors[p_shape] != NULL) {
+ [cursors[p_shape] release];
+ cursors[p_shape] = NULL;
+ }
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
set_cursor_shape(c);
+
+ cursors_cache.erase(p_shape);
}
}
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index facf5b8d91..81b8d08b3d 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -2485,11 +2485,16 @@ void OS_Windows::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shap
DeleteObject(bitmap);
} else {
// Reset to default system cursor
- cursors[p_shape] = NULL;
+ if (cursors[p_shape]) {
+ DestroyIcon(cursors[p_shape]);
+ cursors[p_shape] = NULL;
+ }
CursorShape c = cursor_shape;
cursor_shape = CURSOR_MAX;
set_cursor_shape(c);
+
+ cursors_cache.erase(p_shape);
}
}
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 687981f32b..39160ee720 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -2996,6 +2996,8 @@ void OS_X11::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, c
CursorShape c = current_cursor;
current_cursor = CURSOR_MAX;
set_cursor_shape(c);
+
+ cursors_cache.erase(p_shape);
}
}