Browse Source

Merge pull request #77161 from AThousandShips/touch_texture_fix

Make `TouchScreenButton` connections reference counted
Yuri Sizov 2 years ago
parent
commit
0032c1c0c2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      scene/2d/touch_screen_button.cpp

+ 2 - 2
scene/2d/touch_screen_button.cpp

@@ -42,7 +42,7 @@ void TouchScreenButton::set_texture_normal(const Ref<Texture2D> &p_texture) {
 	}
 	}
 	texture_normal = p_texture;
 	texture_normal = p_texture;
 	if (texture_normal.is_valid()) {
 	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();
 	queue_redraw();
 }
 }
@@ -60,7 +60,7 @@ void TouchScreenButton::set_texture_pressed(const Ref<Texture2D> &p_texture_pres
 	}
 	}
 	texture_pressed = p_texture_pressed;
 	texture_pressed = p_texture_pressed;
 	if (texture_pressed.is_valid()) {
 	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();
 	queue_redraw();
 }
 }