summaryrefslogtreecommitdiff
path: root/scene/gui
diff options
context:
space:
mode:
authorPouleyKetchoupp <pouleyketchoup@gmail.com>2020-05-01 18:41:41 +0200
committerPouleyKetchoupp <pouleyketchoup@gmail.com>2020-05-16 18:13:25 +0200
commit3ad694018fe02447d9ad3051b9d2f6616bc52e74 (patch)
tree9547f3d3ae650d60a201501b6981c11640865bf7 /scene/gui
parentd999071edf137fa8b125c9aa057e3936fe54aed0 (diff)
Fix Container sorting not working when overriding _sort_children in gdscript
Remove _sort_children from script bindings: _sort_children is an internal method which shouldn't be exposed to scripts. Added support for non-bound methods in MessageQueue: So we can use deferred calls without exposing internal methods to scripts. Added debug checks in CallableCustomMethodPointer: Adding method pointer callables to the message queue was causing crashes in case an object was destroyed and the same memory was allocated for another one. The new object had a valid object id but the call was erroneous. Release will be fixed later, along with Variant which has the same problem and is also fixed for debug only.
Diffstat (limited to 'scene/gui')
-rw-r--r--scene/gui/container.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/scene/gui/container.cpp b/scene/gui/container.cpp
index 18a84ce348..a89eef6209 100644
--- a/scene/gui/container.cpp
+++ b/scene/gui/container.cpp
@@ -140,7 +140,7 @@ void Container::queue_sort() {
return;
}
- MessageQueue::get_singleton()->push_call(this, "_sort_children");
+ MessageQueue::get_singleton()->push_callable(callable_mp(this, &Container::_sort_children));
pending_sort = true;
}
@@ -177,8 +177,6 @@ String Container::get_configuration_warning() const {
}
void Container::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_sort_children"), &Container::_sort_children);
-
ClassDB::bind_method(D_METHOD("queue_sort"), &Container::queue_sort);
ClassDB::bind_method(D_METHOD("fit_child_in_rect", "child", "rect"), &Container::fit_child_in_rect);