mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 10:32:20 +00:00
Fix crash in printer config when switching tabs (#6537)
* Fix ASAN with MSVC * Make ASAN happy * Avoid deleting activated tab button by not calling `DeleteAllItems` (#SoftFever/OrcaSlicer#6486)
This commit is contained in:
@@ -117,7 +117,23 @@ int TabCtrl::AppendItem(const wxString &item,
|
||||
|
||||
bool TabCtrl::DeleteItem(int item)
|
||||
{
|
||||
return false;
|
||||
if (item < 0 || item >= btns.size()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Button* btn = btns[item];
|
||||
btn->Destroy();
|
||||
btns.erase(btns.begin() + item);
|
||||
sizer->Remove(item * 2);
|
||||
if (btns.size() > 1)
|
||||
sizer->GetItem(sizer->GetItemCount() - 1)->SetMinSize({0, 0});
|
||||
relayout();
|
||||
if (sel >= item) {
|
||||
sel--;
|
||||
sendTabCtrlEvent();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void TabCtrl::DeleteAllItems()
|
||||
|
||||
Reference in New Issue
Block a user