diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2017-02-26 20:27:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-26 20:27:43 +0100 |
commit | 3abd4c906dfe6e310b448a0b2a5ecb1c2c25388a (patch) | |
tree | 544bee2dd231b345374bfc08ca0a963e5f46e932 | |
parent | e5cf1fe350cb03fd68e68bd246b28cd2dc56b378 (diff) | |
parent | 75c68f65129d404e3ab3be1009bd414a450da85e (diff) |
Merge pull request #7869 from RandomShaper/fix-touchbutton-crash
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 efe23e67f2..4b607e9261 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) { |