Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix EditorInspector crash when exiting #91538

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 2 additions & 11 deletions editor/editor_inspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4039,25 +4039,16 @@ void EditorInspector::_notification(int p_what) {
EditorFeatureProfileManager::get_singleton()->connect("current_feature_profile_changed", callable_mp(this, &EditorInspector::_feature_profile_changed));
set_process(is_visible_in_tree());
add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("Tree")));
} break;

case NOTIFICATION_ENTER_TREE: {
if (!sub_inspector) {
get_tree()->connect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
}
} break;

case NOTIFICATION_PREDELETE: {
if (EditorNode::get_singleton() && !EditorNode::get_singleton()->is_exiting()) {
// Don't need to clean up if exiting, and object may already be freed.
edit(nullptr);
}
} break;

case NOTIFICATION_EXIT_TREE: {
if (!sub_inspector) {
if (!sub_inspector && is_inside_tree()) {
get_tree()->disconnect("node_removed", callable_mp(this, &EditorInspector::_node_removed));
Comment on lines +4048 to 4049
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the current uses of EditorInspector, I don't think this condition will ever be true. As far as I know, all non-sub_inspectors will only be deleted on exit.
I left it here in case this ever changes in the future.

}
edit(nullptr);
} break;

case NOTIFICATION_VISIBILITY_CHANGED: {
Expand Down