diff options
| author | Pedro J. Estébanez | 2017-02-22 01:36:31 +0100 |
|---|---|---|
| committer | Pedro J. Estébanez | 2017-02-22 01:36:31 +0100 |
| commit | 5b8d5766f4574b5011b3f258d3e9b34298eb609c (patch) | |
| tree | 588aae794e11cd4cac18ba239b39a60da720eff7 | |
| parent | d5c2a6b76b9e7a444661d4102e63edd89f2256f8 (diff) | |
| download | godot-5b8d5766f4574b5011b3f258d3e9b34298eb609c.tar.gz godot-5b8d5766f4574b5011b3f258d3e9b34298eb609c.tar.zst godot-5b8d5766f4574b5011b3f258d3e9b34298eb609c.zip | |
Fix crash if TouchScreenButton is pressed while exiting the tree
| -rw-r--r-- | scene/2d/screen_button.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/scene/2d/screen_button.cpp b/scene/2d/screen_button.cpp index 697c387c1..17f2088ae 100644 --- a/scene/2d/screen_button.cpp +++ b/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) { |
