Fix crash on Linux when switching between tabs in printer config (#6437)

* Fix crash due to the wrong window get returned in `PointCtrl` (SoftFever/OrcaSlicer#6261).
`getWindow()` must return the control itself, not its child control; otherwise the child control will be destroyed twice when the tab container is destroyed.

* Fix another crash on Linux caused by unused undo button
This commit is contained in:
Noisyfox 2024-08-18 16:30:45 +08:00 committed by GitHub
parent 01b16814ad
commit 4dd7d79d76
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 5 deletions

View file

@ -266,7 +266,7 @@ void Tab::create_preset_tab()
set_tooltips_text();
add_scaled_button(m_top_panel, &m_undo_btn, m_bmp_white_bullet.name());
add_scaled_button(m_top_panel, &m_undo_to_sys_btn, m_bmp_white_bullet.name());
//add_scaled_button(m_top_panel, &m_undo_to_sys_btn, m_bmp_white_bullet.name());
add_scaled_button(m_top_panel, &m_btn_search, "search");
m_btn_search->SetToolTip(_L("Search in preset"));
@ -347,7 +347,7 @@ void Tab::create_preset_tab()
});
m_undo_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(); }));
m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
//m_undo_to_sys_btn->Bind(wxEVT_BUTTON, ([this](wxCommandEvent) { on_roll_back_value(true); }));
/* m_search_btn->Bind(wxEVT_BUTTON, [](wxCommandEvent) { wxGetApp().plater()->search(false); });*/
// Colors for ui "decoration"
@ -1034,10 +1034,10 @@ void Tab::update_undo_buttons()
{
// BBS: restore all pages in preset
m_undo_btn-> SetBitmap_(m_presets->get_edited_preset().is_dirty ? m_bmp_value_revert: m_bmp_white_bullet);
m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
//m_undo_to_sys_btn-> SetBitmap_(m_is_nonsys_values ? *m_bmp_non_system : m_bmp_value_lock);
m_undo_btn->SetToolTip(m_presets->get_edited_preset().is_dirty ? _L("Click to reset all settings to the last saved preset.") : m_ttg_white_bullet);
m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock);
//m_undo_to_sys_btn->SetToolTip(m_is_nonsys_values ? *m_ttg_non_system : m_ttg_value_lock);
}
void Tab::on_roll_back_value(const bool to_sys /*= true*/)