diff options
Diffstat (limited to 'qt-models/diveimportedmodel.cpp')
-rw-r--r-- | qt-models/diveimportedmodel.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp index 1b8b5a897..f121aef31 100644 --- a/qt-models/diveimportedmodel.cpp +++ b/qt-models/diveimportedmodel.cpp @@ -148,11 +148,18 @@ void DiveImportedModel::repopulate() void DiveImportedModel::recordDives() { + // walk the table of imported dives and record the ones that the user picked + // clearing out the table as we go for (int i = 0; i < rowCount(); i++) { - if (diveTable->dives[i] && checkStates[i]) { - record_dive(diveTable->dives[i]); - diveTable->dives[i] = NULL; + struct dive *d = diveTable->dives[i]; + if (d && checkStates[i]) { + record_dive(d); + } else { + // we should free the dives that weren't recorded + clear_dive(d); + free(d) } + diveTable->dives[i] = NULL; } diveTable->nr = 0; } |