From 087a80194a54554ab0510a3c2ccc906a448d36ba Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 22 Sep 2019 21:48:46 +0200 Subject: 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 --- core/downloadfromdcthread.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'core/downloadfromdcthread.cpp') 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; -- cgit v1.2.3-70-g09d2