From e761bfa5c4c91823f4349322f6ba251471d0eecb Mon Sep 17 00:00:00 2001 From: Srivats P Date: Thu, 27 Apr 2023 11:09:31 +0530 Subject: [PATCH] Make app QObject parent of StreamTiming singleton --- server/streamtiming.cpp | 6 +++--- server/streamtiming.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/server/streamtiming.cpp b/server/streamtiming.cpp index bc5ad5a..ff1eb68 100644 --- a/server/streamtiming.cpp +++ b/server/streamtiming.cpp @@ -23,8 +23,8 @@ along with this program. If not, see #include -StreamTiming::StreamTiming() - : QObject(nullptr) // FIXME: parent +StreamTiming::StreamTiming(QObject *parent) + : QObject(parent) { // This class must be part of the main thread so that timers can work Q_ASSERT(this->thread() == QCoreApplication::instance()->thread()); @@ -219,7 +219,7 @@ StreamTiming* StreamTiming::instance() static StreamTiming *instance{nullptr}; if (!instance) - instance = new StreamTiming(); + instance = new StreamTiming(QCoreApplication::instance()); return instance; } diff --git a/server/streamtiming.h b/server/streamtiming.h index 447f9b1..9e93174 100644 --- a/server/streamtiming.h +++ b/server/streamtiming.h @@ -32,7 +32,6 @@ class StreamTiming : public QObject { Q_OBJECT public: - StreamTiming(); bool recordTxTime(uint portId, uint guid, uint ttagId, const struct timespec ×tamp); @@ -50,6 +49,8 @@ public: static StreamTiming* instance(); private: + StreamTiming(QObject *parent=nullptr); + int processRecords(); int deleteStaleRecords();