Fix segfault from mid-frame font atlas rebuild
The edit-mode font switcher called LoadFont() directly between NewFrame() and Render(), invalidating the font atlas ImGui was actively using. Use RequestLoadFont() to defer the change to the safe inter-frame point, matching the existing zoom pattern. Also default code_font/writing_font to the main font when not explicitly configured, preventing a mismatch that triggered the switch on every first frame. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -577,9 +577,7 @@ GUIFrontend::Step(Editor &ed, bool &running)
|
||||
if (fr.CurrentFontName() != expected && fr.HasFont(expected)) {
|
||||
float sz = fr.CurrentFontSize();
|
||||
if (sz <= 0.0f) sz = config_.font_size;
|
||||
fr.LoadFont(expected, sz);
|
||||
ImGui_ImplOpenGL3_DestroyFontsTexture();
|
||||
ImGui_ImplOpenGL3_CreateFontsTexture();
|
||||
fr.RequestLoadFont(expected, sz);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user