Import: keep dive and dive site tables in DiveImportedModel

The DiveImportedModel and DownloadThread used the same table
of dives and dive sites. This made it very hard to keep the
model consistent: Every modification of the download thread
would make the model inconsistent and could lead to memory
corruption owing to dangling pointers.

Therefore, keep a copy in the model. When updating the model,
use move-semantics, i.e. move the data and reset the tables
of the thread to zero elements.

Since the DiveImportedModel and the DownloadThread are very
tightly integrated, remove the accessor-functions of the
dive and dive-site tables. They fulfilled no purpose
whatsoever as they gave the same access-rights as a public
field.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-09-22 21:48:46 +02:00 committed by Dirk Hohndel
parent a353bcb296
commit 087a80194a
4 changed files with 31 additions and 45 deletions

View file

@ -308,16 +308,6 @@ DCDeviceData *DownloadThread::data()
return m_data;
}
struct dive_table *DownloadThread::table()
{
return &downloadTable;
}
struct dive_site_table *DownloadThread::sites()
{
return &diveSiteTable;
}
QString DCDeviceData::vendor() const
{
return data.vendor;