Make app QObject parent of StreamTiming singleton

This commit is contained in:
Srivats P 2023-04-27 11:09:31 +05:30
parent b9345463c4
commit e761bfa5c4
2 changed files with 5 additions and 4 deletions

View File

@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include <QCoreApplication>
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;
}

View File

@ -32,7 +32,6 @@ class StreamTiming : public QObject
{
Q_OBJECT
public:
StreamTiming();
bool recordTxTime(uint portId, uint guid, uint ttagId,
const struct timespec &timestamp);
@ -50,6 +49,8 @@ public:
static StreamTiming* instance();
private:
StreamTiming(QObject *parent=nullptr);
int processRecords();
int deleteStaleRecords();