fixed unloading of the plugins

This commit is contained in:
Patrick von Reth 2012-02-07 14:04:10 +01:00
parent 9460613875
commit 8d3560b5bf
2 changed files with 7 additions and 3 deletions

View File

@ -64,8 +64,9 @@ QHash<QString, PluginContainer *> SnoreCore::pluginCache(){
return s_pluginCache;
QSettings cache(SnoreCore::pluginDir().absoluteFilePath("plugin.cache"),QSettings::IniFormat);
QString version = cache.value("version").toString();
QString path = cache.value("path").toString();
int size = cache.beginReadArray("plugins");
if(size == 0 || version != Version::revision()){
if(size == 0 || version != Version::revision() || path != pluginDir().path()){
updatePluginCache();
}else{
for(int i=0;i<size;++i) {
@ -106,13 +107,14 @@ void SnoreCore::updatePluginCache(){
}
PluginContainer *info = new PluginContainer( SnoreCore::pluginDir().relativeFilePath(filepath),sp->name(),PluginContainer::typeFromString(type));
s_pluginCache.insert(info->name(),info);
sp->deleteLater();
delete sp;
qDebug()<<"added "<<info->name()<<"to cache";
}
}
qDebug()<<s_pluginCache.keys();
cache.setValue("version",Version::revision());
cache.setValue("path",pluginDir().path());
QList<PluginContainer*> plugins = s_pluginCache.values();
cache.beginWriteArray("plugins");
for(int i=0;i< plugins.size();++i) {

View File

@ -106,6 +106,7 @@ private:
SnarlBackend::SnarlBackend():
SnoreBackend("Snarl"),
m_defautSnarlinetrface(NULL),
m_away(false)
{
@ -118,7 +119,8 @@ SnarlBackend::~SnarlBackend()
this->unregisterApplication(a);
}
}
delete m_defautSnarlinetrface;
if(m_defautSnarlinetrface)
delete m_defautSnarlinetrface;
}