summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNinni Pipping <over999ships@gmail.com>2023-05-18 19:22:23 +0200
committerYuri Sizov <yuris@humnom.net>2023-05-18 21:46:39 +0200
commit589306a9d81c8d63c86269c53990c52fb6d1b503 (patch)
tree7696c4efc7e843ffe064aa11d8f743a73dd7ff14
parent238b8357a313dcb90c86f95a0d52c99dee444875 (diff)
Make `TouchScreenButton` connections reference counted
Prevents errors when assigning the same texture to both slots (cherry picked from commit 0648cc65b2c9bd8a48f3da74ea2c17898cd2b425)
-rw-r--r--scene/2d/touch_screen_button.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/2d/touch_screen_button.cpp b/scene/2d/touch_screen_button.cpp
index 4c8c4f1e16..7da2fc3cb3 100644
--- a/scene/2d/touch_screen_button.cpp
+++ b/scene/2d/touch_screen_button.cpp
@@ -42,7 +42,7 @@ void TouchScreenButton::set_texture_normal(const Ref<Texture2D> &p_texture) {
}
texture_normal = p_texture;
if (texture_normal.is_valid()) {
- texture_normal->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
+ texture_normal->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED);
}
queue_redraw();
}
@@ -60,7 +60,7 @@ void TouchScreenButton::set_texture_pressed(const Ref<Texture2D> &p_texture_pres
}
texture_pressed = p_texture_pressed;
if (texture_pressed.is_valid()) {
- texture_pressed->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw));
+ texture_pressed->connect(SceneStringNames::get_singleton()->changed, callable_mp((CanvasItem *)this, &CanvasItem::queue_redraw), CONNECT_REFERENCE_COUNTED);
}
queue_redraw();
}