mirror of
https://github.com/status-im/snorenotify.git
synced 2025-02-13 08:56:37 +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()
|
||||
{
|
||||
snoreDebug(SNORE_DEBUG) << "Updating plugin cache";
|
||||
foreach(PluginContaienrHash list, s_pluginCache) {
|
||||
for(auto list : s_pluginCache) {
|
||||
foreach(PluginContainer * p, list.values()) {
|
||||
delete p;
|
||||
}
|
||||
|
@ -29,11 +29,15 @@
|
||||
#include <iostream>
|
||||
|
||||
#include <QSettings>
|
||||
#include <QThread>
|
||||
|
||||
using namespace Snore;
|
||||
|
||||
SnoreCore::SnoreCore()
|
||||
{
|
||||
if (QThread::currentThread() != qApp->thread() ) {
|
||||
moveToThread(qApp->thread());
|
||||
}
|
||||
SnoreCorePrivate::registerMetaTypes();
|
||||
d_ptr = new SnoreCorePrivate();
|
||||
Q_D(SnoreCore);
|
||||
@ -55,6 +59,11 @@ SnoreCore::~SnoreCore()
|
||||
|
||||
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);
|
||||
setValue("PluginTypes", QVariant::fromValue(types), LOCAL_SETTING);
|
||||
for (SnorePlugin::PluginTypes type : SnorePlugin::types()) {
|
||||
@ -64,7 +73,6 @@ void SnoreCore::loadPlugins(SnorePlugin::PluginTypes types)
|
||||
if (!plugin) {
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (info->type()) {
|
||||
case SnorePlugin::BACKEND:
|
||||
break;
|
||||
|
@ -71,7 +71,7 @@ public:
|
||||
*
|
||||
* @param types the type of tha plugin
|
||||
*/
|
||||
void loadPlugins(SnorePlugin::PluginTypes types);
|
||||
Q_INVOKABLE void loadPlugins(Snore::SnorePlugin::PluginTypes types);
|
||||
|
||||
/**
|
||||
* Broadcast a notification.
|
||||
|
@ -41,7 +41,7 @@ GrowlBackend::~GrowlBackend()
|
||||
|
||||
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();
|
||||
}
|
||||
snoreDebug(SNORE_DEBUG) << "Growl is not running";
|
||||
|
Loading…
x
Reference in New Issue
Block a user