Fix new project crash on Windows if multi-extruder printer profile is edited (#9600)

Fix new project crash on Windows if profile is edited
This commit is contained in:
Noisyfox 2025-05-14 11:36:50 +08:00 committed by GitHub
parent 1a5b238ba4
commit 3b658cba3b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 4 deletions

View file

@ -590,7 +590,7 @@ Slic3r::GUI::PageShp Tab::add_options_page(const wxString& title, const std::str
}
// Initialize the page.
//BBS: GUI refactor
PageShp page(new Page(m_page_view, title, icon_idx, this));
PageShp page = std::make_shared<Page>(m_page_view, title, icon_idx, this);
// page->SetBackgroundStyle(wxBG_STYLE_SYSTEM);
#ifdef __WINDOWS__
// page->SetDoubleBuffered(true);
@ -6263,8 +6263,12 @@ void Page::update_visibility(ConfigOptionMode mode, bool update_contolls_visibil
#ifdef __WXMSW__
if (!m_show) return;
// BBS: fix field control position
wxTheApp->CallAfter([this]() {
for (auto group : m_optgroups) {
wxTheApp->CallAfter([wp=std::weak_ptr<Page>(shared_from_this())]() {
auto page = wp.lock();
if (!page)
return;
for (auto group : page->m_optgroups) {
if (group->custom_ctrl) group->custom_ctrl->fixup_items_positions();
}
});