possible workaround for a timer initialized in the wrong thread

This commit is contained in:
Patrick von Reth 2014-08-24 11:15:28 +02:00
parent e70a6c8fa8
commit 9fcc70a98b
3 changed files with 17 additions and 8 deletions

View File

@ -131,7 +131,7 @@ void PluginContainer::updatePluginCache()
snoreDebug( SNORE_DEBUG ) << "adding" << file.absoluteFilePath();
QPluginLoader loader(file.absoluteFilePath());
QObject *plugin = loader.instance();
if (plugin == NULL)
if (plugin == NULL)//TODO: Qt5 json stuff
{
snoreDebug( SNORE_WARNING ) << "Failed loading plugin: " << file.absoluteFilePath() << loader.errorString();
continue;

View File

@ -27,6 +27,8 @@
#include <QTimer>
#include <QDir>
#include <QDebug>
#include <QThread>
#include <QMetaMethod>
using namespace Snore;
@ -206,6 +208,11 @@ bool SnoreBackend::deinitialize()
void SnoreBackend::startTimeout(Notification &notification)
{
if(thread() != QThread::currentThread())
{
metaObject()->invokeMethod(this, "startTimeout", Qt::QueuedConnection, Q_ARG(Notification,notification));
return;
}
if(notification.isSticky())
{
return;

View File

@ -60,8 +60,10 @@ public slots:
private slots:
void notificationTimedOut();
protected:
protected slots:
void startTimeout(Notification &notification);
protected:
void closeNotification(Snore::Notification,Snore::Notification::CloseReasons);
void setSupportsRichtext(bool b);