summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-07 10:53:13 +0100
committerGravatar Jan Mulder <jlmulder@xs4all.nl>2018-01-07 13:02:27 +0100
commit04626b089126c67237a579c943d2d36d9ff53f8a (patch)
treeca07ee4476b3f4aa8b282785c08b8be0f4e444b2
parente5980942aabc55b760693acaacbde77c9ed799d2 (diff)
downloadsubsurface-04626b089126c67237a579c943d2d36d9ff53f8a.tar.gz
Fix small memory leak
When deleting a dive from the divelist model, also free the pointed to DiveObjectHelper data. There seems no harm done (other than a memory leak) by this missing free. Found while (again) investigating the infamous crash occuring when deleting a dive from the mobile app when deleting a dive from the dive list. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
-rw-r--r--qt-models/divelistmodel.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/qt-models/divelistmodel.cpp b/qt-models/divelistmodel.cpp
index ba99e47bb..b28bd58a3 100644
--- a/qt-models/divelistmodel.cpp
+++ b/qt-models/divelistmodel.cpp
@@ -76,6 +76,7 @@ void DiveListModel::insertDive(int i, DiveObjectHelper *newDive)
void DiveListModel::removeDive(int i)
{
beginRemoveRows(QModelIndex(), i, i);
+ delete m_dives.at(i);
m_dives.removeAt(i);
endRemoveRows();
}