summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorRémi Verschelde <remi@verschelde.fr>2016-05-11 17:46:29 +0200
committerRémi Verschelde <remi@verschelde.fr>2016-05-11 17:46:29 +0200
commit7b471068cf8e4d166d8b0569b489f595213c3b52 (patch)
tree637f080864f133a156960c07bc7f800707b47cb5 /scene/gui
parentd7318f69653ca090575d1243256fcafe8d9ca25f (diff)
parent0b572b35c2a5b284f7ecae4160fccda9a0eec336 (diff)
Merge pull request #4612 from bojidar-bg/fix-anchor-builds
Fix #4588 (crash in Control::_set_anchor)
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/control.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp
index d0e5e8b7ae..73e7237058 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
}