Make app QObject parent of StreamTiming singleton
This commit is contained in:
parent
b9345463c4
commit
e761bfa5c4
@ -23,8 +23,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|||||||
|
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
|
|
||||||
StreamTiming::StreamTiming()
|
StreamTiming::StreamTiming(QObject *parent)
|
||||||
: QObject(nullptr) // FIXME: parent
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
// This class must be part of the main thread so that timers can work
|
// This class must be part of the main thread so that timers can work
|
||||||
Q_ASSERT(this->thread() == QCoreApplication::instance()->thread());
|
Q_ASSERT(this->thread() == QCoreApplication::instance()->thread());
|
||||||
@ -219,7 +219,7 @@ StreamTiming* StreamTiming::instance()
|
|||||||
static StreamTiming *instance{nullptr};
|
static StreamTiming *instance{nullptr};
|
||||||
|
|
||||||
if (!instance)
|
if (!instance)
|
||||||
instance = new StreamTiming();
|
instance = new StreamTiming(QCoreApplication::instance());
|
||||||
|
|
||||||
return instance;
|
return instance;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,6 @@ class StreamTiming : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
StreamTiming();
|
|
||||||
|
|
||||||
bool recordTxTime(uint portId, uint guid, uint ttagId,
|
bool recordTxTime(uint portId, uint guid, uint ttagId,
|
||||||
const struct timespec ×tamp);
|
const struct timespec ×tamp);
|
||||||
@ -50,6 +49,8 @@ public:
|
|||||||
static StreamTiming* instance();
|
static StreamTiming* instance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
StreamTiming(QObject *parent=nullptr);
|
||||||
|
|
||||||
int processRecords();
|
int processRecords();
|
||||||
int deleteStaleRecords();
|
int deleteStaleRecords();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user