Fix crash on Linux when you searched the placeholder in gcode editor dialog (#9815)

Fix crash on Linux when you searched the placeholder in gcode editor dialog (SoftFever/OrcaSlicer#5671)
This commit is contained in:
Noisyfox 2025-06-07 11:03:25 +08:00 committed by GitHub
parent 3900042280
commit 7f8f36bf40
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -670,6 +670,7 @@ wxDataViewItem ParamsModel::Delete(const wxDataViewItem& item)
ParamsNode* node = static_cast<ParamsNode*>(item.GetID());
if (!node) // happens if item.IsOk()==false
return ret_item;
const bool is_item_enabled = node->IsEnabled();
// first remove the node from the parent's array of children;
// NOTE: m_group_nodes is only a vector of _pointers_
@ -700,8 +701,12 @@ wxDataViewItem ParamsModel::Delete(const wxDataViewItem& item)
ret_item = parent;
}
// Orca: notify enabled item only, because disabled items have already been removed from UI,
// so attempt to notify it cases a crash.
if (is_item_enabled) {
// notify control
ItemDeleted(parent, item);
}
return ret_item;
}