Skip to content

Commit

Permalink
PathGui: fixed potential crash on Path object delete
Browse files Browse the repository at this point in the history
  • Loading branch information
realthunder authored and wwmayer committed Mar 22, 2017
1 parent 9e5f6b2 commit 3f7c4bc
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions src/Mod/Path/Gui/ViewProviderPath.cpp
Expand Up @@ -258,20 +258,25 @@ SoDetail* ViewProviderPath::getDetail(const char* subelement) const
}

void ViewProviderPath::onSelectionChanged(const Gui::SelectionChanges& msg) {
if(msg.Type == Gui::SelectionChanges::SetPreselect &&
msg.pSubName && pt0Index >= 0 &&
strcmp(msg.pDocName,getObject()->getDocument()->getName())==0 &&
strcmp(msg.pObjectName,getObject()->getNameInDocument())==0)
{
Path::Feature* pcPathObj = static_cast<Path::Feature*>(pcObject);
Base::Vector3d pt = pcPathObj->Placement.getValue().inverse().toMatrix()*
Base::Vector3d(msg.x,msg.y,msg.z);
const SbVec3f &ptTo = *pcLineCoords->point.getValues(pt0Index);
SbVec3f ptFrom(pt.x,pt.y,pt.z);
if(ptFrom != ptTo) {
pcArrowTransform->pointAt(ptFrom,ptTo);
pcArrowSwitch->whichChild = 0;
return;
if(msg.Type == Gui::SelectionChanges::SetPreselect && msg.pSubName &&
pt0Index >= 0 && getObject() && getObject()->getDocument())
{
const char *docName = getObject()->getDocument()->getName();
const char *objName = getObject()->getNameInDocument();
if(docName && objName &&
strcmp(msg.pDocName,docName)==0 &&
strcmp(msg.pObjectName,objName)==0)
{
Path::Feature* pcPathObj = static_cast<Path::Feature*>(pcObject);
Base::Vector3d pt = pcPathObj->Placement.getValue().inverse().toMatrix()*
Base::Vector3d(msg.x,msg.y,msg.z);
const SbVec3f &ptTo = *pcLineCoords->point.getValues(pt0Index);
SbVec3f ptFrom(pt.x,pt.y,pt.z);
if(ptFrom != ptTo) {
pcArrowTransform->pointAt(ptFrom,ptTo);
pcArrowSwitch->whichChild = 0;
return;
}
}
}
pcArrowSwitch->whichChild = -1;
Expand Down

0 comments on commit 3f7c4bc

Please sign in to comment.