mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: do not crash on selecting dive computers
For reasons unknown to me, the DCDeviceData instance was freed way too early, and used afterwards, obviously resulting in a SIGSEGV. This commit creates the DCDeviceData as a direct child of the QMLManager instance, ensuring it does not get freed prematurely. Signed-off-by: Jan Mulder <jlmulder@xs4all.nl> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
22e40063f1
commit
a7288cc912
3 changed files with 6 additions and 3 deletions
|
@ -16,11 +16,11 @@ static QString str_error(const char *fmt, ...)
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadThread::DownloadThread() : m_data(new DCDeviceData())
|
DownloadThread::DownloadThread()
|
||||||
{
|
{
|
||||||
|
m_data = DCDeviceData::instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DownloadThread::run()
|
void DownloadThread::run()
|
||||||
{
|
{
|
||||||
auto internalData = m_data->internalData();
|
auto internalData = m_data->internalData();
|
||||||
|
|
|
@ -91,7 +91,8 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
||||||
m_updateSelectedDive(-1),
|
m_updateSelectedDive(-1),
|
||||||
m_selectedDiveTimestamp(0),
|
m_selectedDiveTimestamp(0),
|
||||||
m_credentialStatus(UNKNOWN),
|
m_credentialStatus(UNKNOWN),
|
||||||
alreadySaving(false)
|
alreadySaving(false),
|
||||||
|
m_device_data(new DCDeviceData(this))
|
||||||
{
|
{
|
||||||
#if defined(BT_SUPPORT)
|
#if defined(BT_SUPPORT)
|
||||||
// ensure that we start the BTDiscovery - this should be triggered by the export of the class
|
// ensure that we start the BTDiscovery - this should be triggered by the export of the class
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include "core/btdiscovery.h"
|
#include "core/btdiscovery.h"
|
||||||
#include "core/gpslocation.h"
|
#include "core/gpslocation.h"
|
||||||
|
#include "core/downloadfromdcthread.h"
|
||||||
#include "qt-models/divelistmodel.h"
|
#include "qt-models/divelistmodel.h"
|
||||||
|
|
||||||
class QMLManager : public QObject {
|
class QMLManager : public QObject {
|
||||||
|
@ -204,6 +205,7 @@ private:
|
||||||
bool checkDepth(DiveObjectHelper *myDive, struct dive *d, QString depth);
|
bool checkDepth(DiveObjectHelper *myDive, struct dive *d, QString depth);
|
||||||
bool currentGitLocalOnly;
|
bool currentGitLocalOnly;
|
||||||
bool m_showPin;
|
bool m_showPin;
|
||||||
|
DCDeviceData *m_device_data;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void cloudUserNameChanged();
|
void cloudUserNameChanged();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue