mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-13 17:06:29 +00:00
make sure snore is in the main thread
This commit is contained in:
parent
49180a6495
commit
6746c248c9
@ -87,7 +87,7 @@ bool PluginContainer::isLoaded() const
|
|||||||
void PluginContainer::updatePluginCache()
|
void PluginContainer::updatePluginCache()
|
||||||
{
|
{
|
||||||
snoreDebug(SNORE_DEBUG) << "Updating plugin cache";
|
snoreDebug(SNORE_DEBUG) << "Updating plugin cache";
|
||||||
foreach(PluginContaienrHash list, s_pluginCache) {
|
for(auto list : s_pluginCache) {
|
||||||
foreach(PluginContainer * p, list.values()) {
|
foreach(PluginContainer * p, list.values()) {
|
||||||
delete p;
|
delete p;
|
||||||
}
|
}
|
||||||
|
@ -29,11 +29,15 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
using namespace Snore;
|
using namespace Snore;
|
||||||
|
|
||||||
SnoreCore::SnoreCore()
|
SnoreCore::SnoreCore()
|
||||||
{
|
{
|
||||||
|
if (QThread::currentThread() != qApp->thread() ) {
|
||||||
|
moveToThread(qApp->thread());
|
||||||
|
}
|
||||||
SnoreCorePrivate::registerMetaTypes();
|
SnoreCorePrivate::registerMetaTypes();
|
||||||
d_ptr = new SnoreCorePrivate();
|
d_ptr = new SnoreCorePrivate();
|
||||||
Q_D(SnoreCore);
|
Q_D(SnoreCore);
|
||||||
@ -55,6 +59,11 @@ SnoreCore::~SnoreCore()
|
|||||||
|
|
||||||
void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
|
void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
|
||||||
{
|
{
|
||||||
|
if (QThread::currentThread() != thread() ) {
|
||||||
|
snoreDebug(SNORE_DEBUG) << "Delayed Plugin loading." << QThread::currentThread() << thread();
|
||||||
|
QMetaObject::invokeMethod(this, "loadPlugins", Qt::BlockingQueuedConnection, Q_ARG(Snore::SnorePlugin::PluginTypes, types));
|
||||||
|
return;
|
||||||
|
}
|
||||||
Q_D(SnoreCore);
|
Q_D(SnoreCore);
|
||||||
setValue("PluginTypes", QVariant::fromValue(types), LOCAL_SETTING);
|
setValue("PluginTypes", QVariant::fromValue(types), LOCAL_SETTING);
|
||||||
for (SnorePlugin::PluginTypes type : SnorePlugin::types()) {
|
for (SnorePlugin::PluginTypes type : SnorePlugin::types()) {
|
||||||
@ -64,7 +73,6 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
|
|||||||
if (!plugin) {
|
if (!plugin) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (info->type()) {
|
switch (info->type()) {
|
||||||
case SnorePlugin::BACKEND:
|
case SnorePlugin::BACKEND:
|
||||||
break;
|
break;
|
||||||
|
@ -71,7 +71,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @param types the type of tha plugin
|
* @param types the type of tha plugin
|
||||||
*/
|
*/
|
||||||
void loadPlugins(SnorePlugin::PluginTypes types);
|
Q_INVOKABLE void loadPlugins(Snore::SnorePlugin::PluginTypes types);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Broadcast a notification.
|
* Broadcast a notification.
|
||||||
|
@ -41,7 +41,7 @@ GrowlBackend::~GrowlBackend()
|
|||||||
|
|
||||||
bool GrowlBackend::initialize()
|
bool GrowlBackend::initialize()
|
||||||
{
|
{
|
||||||
if (Growl::init((GROWL_CALLBACK)&GrowlBackend::gntpCallback) && Growl::isRunning(GROWL_TCP)) {
|
if (Growl::init((GROWL_CALLBACK)&GrowlBackend::gntpCallback) && Growl::isRunning(GROWL_TCP, value("Host").toString().toUtf8().constData())) {
|
||||||
return SnoreBackend::initialize();
|
return SnoreBackend::initialize();
|
||||||
}
|
}
|
||||||
snoreDebug(SNORE_DEBUG) << "Growl is not running";
|
snoreDebug(SNORE_DEBUG) << "Growl is not running";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user