BLACK_AUDIT_X for killTimer, trace Qt killTimer warnings in "our" code

This commit is contained in:
Klaus Basan
2020-01-27 15:13:14 +01:00
committed by Mat Sutcliffe
parent 4ca3a925ce
commit 481833b003
3 changed files with 24 additions and 5 deletions

View File

@@ -10,6 +10,8 @@
#include "loadindicator.h"
#include "guiapplication.h"
#include "blackmisc/verify.h"
#include "blackmisc/threadutils.h"
#include <QColor>
#include <QPainter>
@@ -18,6 +20,8 @@
#include <QSizePolicy>
#include <QtGlobal>
using namespace BlackMisc;
namespace BlackGui
{
CLoadIndicator::CLoadIndicator(int width, int height, QWidget *parent)
@@ -86,7 +90,11 @@ namespace BlackGui
if (!m_pendingIds.isEmpty()) { return; }
}
m_pendingIds.clear();
if (m_timerId != -1) { killTimer(m_timerId); }
if (m_timerId != -1)
{
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
this->killTimer(m_timerId);
}
m_timerId = -1;
this->hide();
this->setEnabled(false);
@@ -96,7 +104,11 @@ namespace BlackGui
void CLoadIndicator::setAnimationDelay(int delay)
{
m_delayMs = delay;
if (m_timerId != -1) { this->killTimer(m_timerId); }
if (m_timerId != -1)
{
BLACK_AUDIT_X(CThreadUtils::isCurrentThreadObjectThread(this), Q_FUNC_INFO, "Try to kill timer from another thread");
this->killTimer(m_timerId);
}
m_timerId = this->startTimer(m_delayMs);
}
@@ -118,14 +130,14 @@ namespace BlackGui
void CLoadIndicator::timerEvent(QTimerEvent *event)
{
Q_UNUSED(event);
Q_UNUSED(event)
m_angle = (m_angle + 30) % 360;
this->update();
}
void CLoadIndicator::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
Q_UNUSED(event)
QPainter p(this);
this->paint(p);
}