Skip to content

Commit af88183

Browse files
authored
Fix ssp delete connection crash (#12511) (#12513)
1 parent 1887e0b commit af88183

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

OMEdit/OMEditLIB/Modeling/ModelWidgetContainer.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1600,8 +1600,7 @@ void GraphicsView::deleteConnectionFromClass(LineAnnotation *pConnectionLineAnno
16001600
CompositeModelEditor *pCompositeModelEditor = dynamic_cast<CompositeModelEditor*>(mpModelWidget->getEditor());
16011601
pCompositeModelEditor->deleteConnection(pConnectionLineAnnotation->getStartElementName(), pConnectionLineAnnotation->getEndElementName());
16021602
} else if (mpModelWidget->getLibraryTreeItem()->getLibraryType()== LibraryTreeItem::OMS) {
1603-
OMSProxy::instance()->deleteConnection(pConnectionLineAnnotation->getStartElement()->getLibraryTreeItem()->getNameStructure(),
1604-
pConnectionLineAnnotation->getEndElement()->getLibraryTreeItem()->getNameStructure());
1603+
OMSProxy::instance()->deleteConnection(pConnectionLineAnnotation->getStartElementName(), pConnectionLineAnnotation->getEndElementName());
16051604
} else {
16061605
// delete the connection
16071606
if (pMainWindow->getOMCProxy()->deleteConnection(pConnectionLineAnnotation->getStartElementName(), pConnectionLineAnnotation->getEndElementName(), mpModelWidget->getLibraryTreeItem()->getNameStructure())) {
@@ -9077,20 +9076,8 @@ void ModelWidget::drawOMSModelConnections()
90779076
}
90789077

90799078
LineAnnotation *pConnectionLineAnnotation = new LineAnnotation(lineShape, pStartConnectorComponent, pEndConnectorComponent, mpDiagramGraphicsView);
9080-
QString startComponentName, endComponentName;
9081-
if (pStartConnectorComponent->getParentElement()) {
9082-
startComponentName = QString("%1.%2").arg(pStartConnectorComponent->getRootParentElement()->getName()).arg(pStartConnectorComponent->getName());
9083-
} else {
9084-
startComponentName = pStartConnectorComponent->getName();
9085-
}
9086-
pConnectionLineAnnotation->setStartElementName(startComponentName);
9087-
if (pEndConnectorComponent->getParentElement()) {
9088-
endComponentName = QString("%1.%2").arg(pEndConnectorComponent->getRootParentElement()->getName()).arg(pEndConnectorComponent->getName());
9089-
} else {
9090-
endComponentName = pEndConnectorComponent->getName();
9091-
}
9092-
pConnectionLineAnnotation->setEndElementName(endComponentName);
9093-
9079+
pConnectionLineAnnotation->setStartElementName(pStartConnectorComponent->getLibraryTreeItem() ? pStartConnectorComponent->getLibraryTreeItem()->getNameStructure() : "");
9080+
pConnectionLineAnnotation->setEndElementName(pEndConnectorComponent->getLibraryTreeItem() ? pEndConnectorComponent->getLibraryTreeItem()->getNameStructure() : "");
90949081
pConnectionLineAnnotation->setOMSConnectionType(pConnections[i]->type);
90959082
pConnectionLineAnnotation->updateToolTip();
90969083
pConnectionLineAnnotation->drawCornerItems();

0 commit comments

Comments
 (0)