diff --git a/include/edge.h b/include/edge.h index 1bda57f..84cb77d 100644 --- a/include/edge.h +++ b/include/edge.h @@ -11,7 +11,6 @@ class Edge : public QGraphicsItem public: Edge(Node *sourceNode, Node *destNode); - ~Edge(); Node *sourceNode() const; Node *destNode() const; diff --git a/lang/locale.pri b/lang/locale.pri index 3116692..729e4ae 100644 --- a/lang/locale.pri +++ b/lang/locale.pri @@ -6,7 +6,7 @@ TRANSLATIONS = lang/qtmindmap_hu.ts \ qmfiles = .qm/i18n/qtmindmap_hu.qm \ .qm/i18n/qtmindmap_nb_NO.qm -system(mkdir -p .qm/i18n && touch $${qmfiles}) +system(mkdir -p .qm/i18n) isEmpty(QMAKE_LRELEASE) diff --git a/src/edge.cpp b/src/edge.cpp index 0b99a13..f1cd73a 100644 --- a/src/edge.cpp +++ b/src/edge.cpp @@ -26,12 +26,6 @@ Edge::Edge(Node *sourceNode, Node *destNode) adjust(); } -Edge::~Edge() -{ - m_sourceNode->removeEdgeFromList(this); - m_destNode->removeEdgeFromList(this); -} - Node * Edge::sourceNode() const { return m_sourceNode; diff --git a/src/node.cpp b/src/node.cpp index 1c96e7a..f872aa5 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -37,7 +37,13 @@ Node::Node(GraphWidget *parent) : Node::~Node() { // dtor of Edge will call removeEdgeFromList on booth nodes. - foreach (EdgeElement element, m_edgeList) delete element.edge; + foreach (EdgeElement element, m_edgeList) + { + Edge *tmp = element.edge; + tmp->sourceNode()->removeEdgeFromList(tmp); + tmp->destNode()->removeEdgeFromList(tmp); + delete tmp; + } } void Node::addEdge(Edge *edge, bool startsFromThisNode) @@ -56,7 +62,10 @@ void Node::deleteEdge(Node *otherEnd) || (it->edge->sourceNode() == this && it->edge->destNode() == otherEnd)) { - delete it->edge; + Edge *tmp = it->edge; + tmp->sourceNode()->removeEdgeFromList(tmp); + tmp->destNode()->removeEdgeFromList(tmp); + delete tmp; return; } }