Skip to content

Commit

Permalink
Move in-editor ImGuiController to root node (fix crash on exit)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkdawson committed Aug 4, 2024
1 parent 4725ad0 commit 9facea9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions gdext/src/ImGuiGD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,14 @@ bool ImGuiGD::ToolInit()
if (!Engine::get_singleton()->is_editor_hint())
return false;

Node* plugin = Object::cast_to<Node>(Engine::get_singleton()->get_singleton("ImGuiPlugin"));
const Node* plugin = Object::cast_to<Node>(Engine::get_singleton()->get_singleton("ImGuiPlugin"));
ERR_FAIL_COND_V(!plugin, false);
if (!plugin->get_node_or_null("ImGuiController"))
Window* parent = plugin->get_window();
ERR_FAIL_COND_V(!parent, false);

if (!parent->get_node_or_null("ImGuiController"))
{
plugin->add_child(memnew(ImGuiController));
parent->add_child(memnew(ImGuiController));
}
return true;
#else
Expand Down

0 comments on commit 9facea9

Please sign in to comment.