Gui: fix crash on selecting removing object

The crash happens if some code calls Gui::Selection().addSelect() of a
removing object in response to App::Document::signalDeletedObject.
This commit is contained in:
Zheng, Lei
2020-06-04 11:59:13 +08:00
committed by wwmayer
parent 86759ddfbf
commit 3f2f8ce039

View File

@@ -1623,6 +1623,8 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject
FC_ERR("Object not found");
return -1;
}
if(sel.pObject->testStatus(App::ObjectStatus::Remove))
return -1;
if(pSubName)
sel.SubName = pSubName;
if(!resolve)
@@ -1638,6 +1640,8 @@ int SelectionSingleton::checkSelection(const char *pDocName, const char *pObject
FC_ERR("Sub-object " << sel.DocName << '#' << sel.FeatName << '.' << sel.SubName << " not found");
return -1;
}
if(sel.pResolvedObject->testStatus(App::ObjectStatus::Remove))
return -1;
std::string subname;
std::string prefix;
if(pSubName && element) {