fix: additional memory guard

This commit is contained in:
parker
2025-06-23 14:41:36 +01:00
parent 794c9995ca
commit 278a3c552f

View File

@@ -80,6 +80,7 @@ void Network::deleteEdge(QGraphicsItem* edge)
prevHoverItem_=nullptr; prevHoverItem_=nullptr;
} }
scene_->removeItem(edge); scene_->removeItem(edge);
scene_->update();
delete edge; delete edge;
} }
@@ -224,7 +225,7 @@ void Network::keyPressEvent(QKeyEvent *event)
void Network::highlightEdge(QGraphicsItem* edge, bool state) void Network::highlightEdge(QGraphicsItem* edge, bool state)
{ {
if(!edge) return; if(!edge || !isType<NodeEdgeGraphic>(edge)) return;
if(state) if(state)
{ {
static_cast<NodeEdgeGraphic*>(edge)->setColor(QColor("red")); static_cast<NodeEdgeGraphic*>(edge)->setColor(QColor("red"));