mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
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:
@@ -670,6 +670,7 @@ wxDataViewItem ParamsModel::Delete(const wxDataViewItem& item)
|
|||||||
ParamsNode* node = static_cast<ParamsNode*>(item.GetID());
|
ParamsNode* node = static_cast<ParamsNode*>(item.GetID());
|
||||||
if (!node) // happens if item.IsOk()==false
|
if (!node) // happens if item.IsOk()==false
|
||||||
return ret_item;
|
return ret_item;
|
||||||
|
const bool is_item_enabled = node->IsEnabled();
|
||||||
|
|
||||||
// first remove the node from the parent's array of children;
|
// first remove the node from the parent's array of children;
|
||||||
// NOTE: m_group_nodes is only a vector of _pointers_
|
// NOTE: m_group_nodes is only a vector of _pointers_
|
||||||
@@ -700,8 +701,12 @@ wxDataViewItem ParamsModel::Delete(const wxDataViewItem& item)
|
|||||||
ret_item = parent;
|
ret_item = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
// notify control
|
// Orca: notify enabled item only, because disabled items have already been removed from UI,
|
||||||
ItemDeleted(parent, item);
|
// so attempt to notify it cases a crash.
|
||||||
|
if (is_item_enabled) {
|
||||||
|
// notify control
|
||||||
|
ItemDeleted(parent, item);
|
||||||
|
}
|
||||||
return ret_item;
|
return ret_item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user