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 | |
parent | 7cec20e4f295ea2f92613b0231a765d710c2411a (diff) |
fix crash
-rw-r--r-- | editor/ground-editor.cpp | 4 | ||||
-rw-r--r-- | editor/imgui.cpp | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/editor/ground-editor.cpp b/editor/ground-editor.cpp index 4253575c..e99448fb 100644 --- a/editor/ground-editor.cpp +++ b/editor/ground-editor.cpp @@ -19,7 +19,11 @@ void ground_editor::load_atlases() { fm_assert(_atlases.empty()); for (const auto& g : loader.ground_atlas_list()) + { + (void)loader.ground_atlas(g.name); + fm_assert(g.atlas); _atlases[g.name] = &g; + } fm_assert(!_atlases.empty()); } 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); } |