Skip to content

Commit

Permalink
Fixes crash in caused by calling `ColorPickerButton.propagate_notific…
Browse files Browse the repository at this point in the history
…ation(33)`
  • Loading branch information
miraz12 committed Oct 25, 2021
1 parent 62f56af commit 35eeafd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions scene/gui/control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,9 @@ void Control::_notification(int p_notification) {
data.SI = get_viewport()->_gui_add_subwindow_control(this);
} else {
//is a regular root control
data.RI = get_viewport()->_gui_add_root_control(this);
Viewport *viewport = get_viewport();
ERR_FAIL_COND(!viewport);
data.RI = viewport->_gui_add_root_control(this);
}

data.parent_canvas_item = get_parent_item();
Expand All @@ -534,7 +536,9 @@ void Control::_notification(int p_notification) {
data.parent_canvas_item->connect("item_rect_changed", this, "_size_changed");
} else {
//connect viewport
get_viewport()->connect("size_changed", this, "_size_changed");
Viewport *viewport = get_viewport();
ERR_FAIL_COND(!viewport);
viewport->connect("size_changed", this, "_size_changed");
}
}

Expand All @@ -552,7 +556,9 @@ void Control::_notification(int p_notification) {
data.parent_canvas_item = nullptr;
} else if (!is_set_as_toplevel()) {
//disconnect viewport
get_viewport()->disconnect("size_changed", this, "_size_changed");
Viewport *viewport = get_viewport();
ERR_FAIL_COND(!viewport);
viewport->disconnect("size_changed", this, "_size_changed");
}

if (data.MI) {
Expand Down

0 comments on commit 35eeafd

Please sign in to comment.