diff --git a/src/video_display.cpp b/src/video_display.cpp index 3a5c2d40d..7764a2bd9 100644 --- a/src/video_display.cpp +++ b/src/video_display.cpp @@ -409,12 +409,14 @@ void VideoDisplay::SetZoomFromBoxText(wxCommandEvent &) { } void VideoDisplay::SetTool(std::unique_ptr new_tool) { + // Set the tool first to prevent repeated initialization from VideoDisplay::Render + tool = std::move(new_tool); + + // Hide the tool bar first to eliminate unecessary size changes + toolBar->Show(false); toolBar->ClearTools(); toolBar->AddSeparator(); toolBar->Realize(); - toolBar->Show(false); - - tool = std::move(new_tool); tool->SetToolbar(toolBar); // Update size as the new typesetting tool may have changed the subtoolbar size