From 937f6112ce64255db980c0b1df9818d0a52a4a33 Mon Sep 17 00:00:00 2001 From: Vojtech Kral Date: Tue, 26 Mar 2019 17:57:54 +0100 Subject: [PATCH] imgui: Fix assert caused by set_language() while new frame is open --- src/slic3r/GUI/ImGuiWrapper.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/slic3r/GUI/ImGuiWrapper.cpp b/src/slic3r/GUI/ImGuiWrapper.cpp index 0050b6463..0932c8ce9 100644 --- a/src/slic3r/GUI/ImGuiWrapper.cpp +++ b/src/slic3r/GUI/ImGuiWrapper.cpp @@ -56,6 +56,14 @@ bool ImGuiWrapper::init() void ImGuiWrapper::set_language(const std::string &language) { + if (m_new_frame_open) { + // ImGUI internally locks the font between NewFrame() and EndFrame() + // NewFrame() might've been called here because of input from the 3D scene; + // call EndFrame() + ImGui::EndFrame(); + m_new_frame_open = false; + } + const ImWchar *ranges = nullptr; size_t idx = language.find('_'); std::string lang = (idx == std::string::npos) ? language : language.substr(0, idx);