Fix Control not disconnecting signal
If a Control has not parent CanvasItem and is set as top_level, then it does not disconnect from the "size_changed" signal when it leaves the Canvas. This patch corrects this.
This commit is contained in:
parent
ea9bb98f26
commit
c0f0f26615
@ -2885,8 +2885,8 @@ void Control::_notification(int p_notification) {
|
|||||||
if (data.parent_canvas_item) {
|
if (data.parent_canvas_item) {
|
||||||
data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed));
|
data.parent_canvas_item->disconnect("item_rect_changed", callable_mp(this, &Control::_size_changed));
|
||||||
data.parent_canvas_item = nullptr;
|
data.parent_canvas_item = nullptr;
|
||||||
} else if (!is_set_as_top_level()) {
|
} else {
|
||||||
//disconnect viewport
|
// Disconnect viewport.
|
||||||
Viewport *viewport = get_viewport();
|
Viewport *viewport = get_viewport();
|
||||||
ERR_FAIL_COND(!viewport);
|
ERR_FAIL_COND(!viewport);
|
||||||
viewport->disconnect("size_changed", callable_mp(this, &Control::_size_changed));
|
viewport->disconnect("size_changed", callable_mp(this, &Control::_size_changed));
|
||||||
|
Loading…
Reference in New Issue
Block a user