diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-13 05:05:22 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2024-01-13 05:05:22 +0100 |
commit | ae6efec53be5e66506a1e0adcbe1bfaa2eb11812 (patch) | |
tree | 04c0da7da415413763ac3f28cf9cfad8e6e37aa1 /editor/imgui.cpp | |
parent | 7cec20e4f295ea2f92613b0231a765d710c2411a (diff) |
fix crash
Diffstat (limited to 'editor/imgui.cpp')
-rw-r--r-- | editor/imgui.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/editor/imgui.cpp b/editor/imgui.cpp index 0cc8274b..3021a338 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -22,11 +22,15 @@ void app::init_imgui(Vector2i size) { if (!_imgui) [[unlikely]] { - _imgui = Pointer<ImGuiIntegration::Context>{InPlaceInit, Vector2{size}, size, size}; + _imgui = Pointer<ImGuiIntegration::Context>{InPlaceInit, NoCreate}; + *_imgui = ImGuiIntegration::Context{Vector2{size}, size, size}; fm_assert(_imgui->context()); } else + { + fm_assert(_imgui->context()); _imgui->relayout(Vector2{size}, size, size); + } } void app::render_menu() @@ -387,7 +391,10 @@ void app::do_popup_menu() void app::kill_popups(bool hard) { - const bool imgui = _imgui->context() != nullptr; + const bool imgui = _imgui != nullptr; + + if (imgui) + fm_assert(_imgui->context()); _pending_popup = false; _popup_target = {}; @@ -395,13 +402,13 @@ void app::kill_popups(bool hard) if (hard) tested_light_chunk = {}; - if (imgui) + if (_imgui) ImGui::CloseCurrentPopup(); if (hard) inspectors.clear(); - if (imgui) + if (_imgui) ImGui::FocusWindow(nullptr); } |