Add back control pool

This commit is contained in:
SoftFever 2024-06-16 01:24:44 +08:00
parent 0b9a6b5fe4
commit 1ff70be243
7 changed files with 162 additions and 27 deletions

View file

@ -3268,7 +3268,10 @@ void GUI_App::check_printer_presets()
#endif
}
void GUI_App::recreate_GUI(const wxString& msg_name)
void switch_window_pools();
void release_window_pools();
void GUI_App::recreate_GUI(const wxString &msg_name)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << "recreate_GUI enter";
m_is_recreating_gui = true;
@ -3276,12 +3279,18 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
update_http_extra_header();
mainframe->shutdown();
ProgressDialog dlg(msg_name, msg_name, 100, nullptr, wxPD_AUTO_HIDE);
dlg.Pulse();
dlg.Update(10, _L("Rebuild") + dots);
MainFrame *old_main_frame = mainframe;
struct ClientData : wxClientData
{
~ClientData() { release_window_pools(); }
};
old_main_frame->SetClientObject(new ClientData);
switch_window_pools();
mainframe = new MainFrame();
if (is_editor())
// hide settings tabs after first Layout