From a7dcea9a6e6e5b4b2eccc2ed0d6803c8408ffd0e Mon Sep 17 00:00:00 2001 From: kali Date: Wed, 3 Feb 2021 22:46:45 +0100 Subject: [bug] add mutex to critical region This fixes the segfault. mRootItem has to be deallocated to avoid memory leaks, but doing it concurrently with the dump of the json was a terrible idea. - Closes: #360 --- gui/qjsonmodel.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'gui/qjsonmodel.h') diff --git a/gui/qjsonmodel.h b/gui/qjsonmodel.h index c7d25bb..50eebcd 100644 --- a/gui/qjsonmodel.h +++ b/gui/qjsonmodel.h @@ -83,7 +83,7 @@ public: QJsonModel(const QString& fileName, QObject *parent = nullptr); QJsonModel(QIODevice * device, QObject *parent = nullptr); QJsonModel(const QByteArray& json, QObject *parent = nullptr); - ~QJsonModel(); + virtual ~QJsonModel(); bool load(const QString& fileName); bool load(QIODevice * device); bool loadJson(const QByteArray& json); @@ -101,11 +101,8 @@ public: private: QJsonValue genJson(QJsonTreeItem *) const; - QJsonTreeItem * mRootItem; QStringList mHeaders; - - }; #endif // QJSONMODEL_H -- cgit v1.2.3