fix crash when selecting radar site with new ImGui contexts

This commit is contained in:
AdenKoperczak 2025-01-06 08:57:55 -05:00
parent 6d107f6c2d
commit 9bd5af03f9
3 changed files with 7 additions and 1 deletions

View file

@ -161,8 +161,12 @@ void DrawLayer::RenderWithoutImGui(
p->textureAtlasBuildCount_ = newTextureAtlasBuildCount; p->textureAtlasBuildCount_ = newTextureAtlasBuildCount;
} }
void DrawLayer::ImGuiSelectContext()
{
ImGui::SetCurrentContext(p->imGuiContext_);
}
void DrawLayer::Render(const QMapLibre::CustomLayerRenderParameters& params) void DrawLayer::Render(const QMapLibre::CustomLayerRenderParameters& params)
{ {
StartImGuiFrame(); StartImGuiFrame();
RenderWithoutImGui(params); RenderWithoutImGui(params);

View file

@ -37,6 +37,7 @@ protected:
void ImGuiInitialize(); void ImGuiInitialize();
void void
RenderWithoutImGui(const QMapLibre::CustomLayerRenderParameters& params); RenderWithoutImGui(const QMapLibre::CustomLayerRenderParameters& params);
void ImGuiSelectContext();
private: private:
std::unique_ptr<DrawLayerImpl> p; std::unique_ptr<DrawLayerImpl> p;

View file

@ -140,6 +140,7 @@ void RadarSiteLayer::Impl::RenderRadarSite(
if (ImGui::Button(radarSite->id().c_str())) if (ImGui::Button(radarSite->id().c_str()))
{ {
Q_EMIT self_->RadarSiteSelected(radarSite->id()); Q_EMIT self_->RadarSiteSelected(radarSite->id());
self_->ImGuiSelectContext();
} }
// Store hover text for mouse picking pass // Store hover text for mouse picking pass