diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-12-10 15:21:50 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-12-17 07:37:32 -0800 |
commit | abf942f30300e6d46652c312f2b531dc3540b19a (patch) | |
tree | 786e7b00fb7dd9ea0b54c1dfc3d989d6c1d29036 /core/downloadfromdcthread.cpp | |
parent | 6184f5d2761b559edf85063eca61389bb82ad343 (diff) | |
download | subsurface-abf942f30300e6d46652c312f2b531dc3540b19a.tar.gz |
Cleanup: make DCDeviceData a "normal" singleton
DCDeviceData was using that weird pattern where the instance
variable was set in the constructor. There is no apparent
reason to do so, therefore convert to a "normal" singleton.
Access that directly in QMLManager instead of saving it in
a member variable first.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/downloadfromdcthread.cpp')
-rw-r--r-- | core/downloadfromdcthread.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index 8e937346d..ec0705cc1 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -24,7 +24,6 @@ static QString str_error(const char *fmt, ...) return str; } - static void updateRememberedDCs() { QString current = qPrefDiveComputer::vendor() + " - " + qPrefDiveComputer::product() + " - " + qPrefDiveComputer::device(); @@ -254,7 +253,6 @@ void show_computer_list() qDebug() << msg; } } -DCDeviceData *DCDeviceData::m_instance = NULL; DCDeviceData::DCDeviceData() { @@ -276,18 +274,12 @@ DCDeviceData::DCDeviceData() #else data.libdc_log = false; #endif - if (m_instance) { - qDebug() << "already have an instance of DCDevieData"; - return; - } - m_instance = this; } DCDeviceData *DCDeviceData::instance() { - if (!m_instance) - m_instance = new DCDeviceData; - return m_instance; + static DCDeviceData self; + return &self; } QStringList DCDeviceData::getProductListFromVendor(const QString &vendor) |