diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-18 11:25:05 +0200 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-09-19 09:44:36 +0200 |
commit | b7d1371910dad02c05bfd9ecd65a73de97871b9c (patch) | |
tree | 9bdcb3083f1c0df40505848bfe9930be2b7fb873 /vcl/qt5/Qt5Timer.cxx | |
parent | 56ac8214ab35387f8861044b62c79fae6d7ccac5 (diff) |
Qt5 minimal initial fix for Java UNO
This is just a minimal fix for Qt errors from JunitTest_svx_unoapi,
which was manipulating Qt5Timer and other timers, resulting in a
spew of timer error messages like:
QObject::killTimer: Timers cannot be stopped from another thread
QObject::startTimer: Timers cannot be started from another thread
QBasicTimer::start: QBasicTimer can only be used with threads started with QThread
Eventually all the QWidget manipulation in the Qt5Frame must be
redirected to the main thread, just like Qt5FilePicker already does.
Change-Id: I66054e6c90f99d27bd5818dcaa5876c515867f77
Reviewed-on: https://gerrit.libreoffice.org/60672
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
Diffstat (limited to 'vcl/qt5/Qt5Timer.cxx')
-rw-r--r-- | vcl/qt5/Qt5Timer.cxx | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/vcl/qt5/Qt5Timer.cxx b/vcl/qt5/Qt5Timer.cxx index 6a9faf829342..7fcb7e17dcda 100644 --- a/vcl/qt5/Qt5Timer.cxx +++ b/vcl/qt5/Qt5Timer.cxx @@ -24,14 +24,14 @@ #include <QtCore/QThread> #include <vcl/svapp.hxx> +#include <sal/log.hxx> Qt5Timer::Qt5Timer() { m_aTimer.setSingleShot(true); - // run the timer itself in the main / creator thread - connect(&m_aTimer, SIGNAL(timeout()), this, SLOT(timeoutActivated()), Qt::QueuedConnection); - // QTimer::start() can be called only in its creator thread - connect(this, SIGNAL(startTimerSignal()), this, SLOT(startTimer()), Qt::QueuedConnection); + connect(&m_aTimer, SIGNAL(timeout()), this, SLOT(timeoutActivated())); + connect(this, SIGNAL(startTimerSignal(int)), this, SLOT(startTimer(int))); + connect(this, SIGNAL(stopTimerSignal()), this, SLOT(stopTimer())); } void Qt5Timer::timeoutActivated() @@ -40,17 +40,12 @@ void Qt5Timer::timeoutActivated() CallCallback(); } -void Qt5Timer::startTimer() { m_aTimer.start(); } +void Qt5Timer::startTimer(int nMS) { m_aTimer.start(nMS); } -void Qt5Timer::Start(sal_uIntPtr nMS) -{ - m_aTimer.setInterval(nMS); - if (qApp->thread() == QThread::currentThread()) - startTimer(); - else - Q_EMIT startTimerSignal(); -} +void Qt5Timer::Start(sal_uIntPtr nMS) { Q_EMIT startTimerSignal(nMS); } + +void Qt5Timer::stopTimer() { m_aTimer.stop(); } -void Qt5Timer::Stop() { m_aTimer.stop(); } +void Qt5Timer::Stop() { Q_EMIT stopTimerSignal(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |