فهرست منبع

Fix crash if TouchScreenButton is pressed while exiting the tree

(cherry picked from commit 5b8d5766f4574b5011b3f258d3e9b34298eb609c)
Pedro J. Estébanez 8 سال پیش
والد
کامیت
75c68f6512
1فایلهای تغییر یافته به همراه8 افزوده شده و 6 حذف شده
  1. 8 6
      scene/2d/screen_button.cpp

+ 8 - 6
scene/2d/screen_button.cpp

@@ -308,12 +308,14 @@ void TouchScreenButton::_release(bool p_exiting_tree) {
 	if (action_id!=-1) {
 
 		Input::get_singleton()->action_release(action);
-		InputEvent ie;
-		ie.type=InputEvent::ACTION;
-		ie.ID=0;
-		ie.action.action=action_id;
-		ie.action.pressed=false;
-		get_tree()->input_event(ie);
+		if (!p_exiting_tree) {
+			InputEvent ie;
+			ie.type=InputEvent::ACTION;
+			ie.ID=0;
+			ie.action.action=action_id;
+			ie.action.pressed=false;
+			get_tree()->input_event(ie);
+		}
 	}
 
 	if (!p_exiting_tree) {