summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-09-22 21:48:46 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-02 08:04:49 -0700
commit087a80194a54554ab0510a3c2ccc906a448d36ba (patch)
tree85d52ff0cda47c3c2937ef8e5b1014ad36f7ee66 /core
parenta353bcb2961b5c9104097ecf57eeeda4b9e37a9f (diff)
downloadsubsurface-087a80194a54554ab0510a3c2ccc906a448d36ba.tar.gz
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>
Diffstat (limited to 'core')
-rw-r--r--core/downloadfromdcthread.cpp10
-rw-r--r--core/downloadfromdcthread.h6
2 files changed, 2 insertions, 14 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp
index 67d628d31..34f1eb748 100644
--- a/core/downloadfromdcthread.cpp
+++ b/core/downloadfromdcthread.cpp
@@ -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;
diff --git a/core/downloadfromdcthread.h b/core/downloadfromdcthread.h
index 3a93115db..4284c2cc6 100644
--- a/core/downloadfromdcthread.h
+++ b/core/downloadfromdcthread.h
@@ -64,13 +64,11 @@ public:
void run() override;
DCDeviceData *data();
- struct dive_table *table();
- struct dive_site_table *sites();
QString error;
-
-private:
struct dive_table downloadTable;
struct dive_site_table diveSiteTable;
+
+private:
DCDeviceData *m_data;
};