diff options
author | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2016-05-10 20:20:28 +0300 |
---|---|---|
committer | Bojidar Marinov <bojidar.marinov.bg@gmail.com> | 2016-05-10 20:23:58 +0300 |
commit | 0b572b35c2a5b284f7ecae4160fccda9a0eec336 (patch) | |
tree | 46dbdcca3ef589c054c347e861a941ddb3a141ab /scene/gui/control.cpp | |
parent | b78b01354d7deb0f52c95539805688943b44695f (diff) |
Fix #4588 (crash Control::_set_anchor)
Thanks to @vnen for testing this
Diffstat (limited to 'scene/gui/control.cpp')
-rw-r--r-- | scene/gui/control.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 86ec31a9c2..7b3ac2a815 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -1287,14 +1287,13 @@ void Control::set_anchor(Margin p_margin,AnchorType p_anchor, bool p_keep_margin void Control::_set_anchor(Margin p_margin,AnchorType p_anchor) { #ifdef TOOLS_ENABLED - SceneTree *st=OS::get_singleton()->get_main_loop()->cast_to<SceneTree>(); - if (st && st->is_editor_hint()) { + if (is_inside_tree() && get_tree()->is_editor_hint()) { set_anchor(p_margin, p_anchor, EDITOR_DEF("2d_editor/keep_margins_when_changing_anchors", false)); } else { - set_anchor(p_margin, p_anchor); + set_anchor(p_margin, p_anchor, false); } #else - set_anchor(p_margin, p_anchor); + set_anchor(p_margin, p_anchor, false); #endif } |