author | harlekin <harlekin> | 2002-11-21 16:25:44 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-11-21 16:25:44 (UTC) |
commit | 7edc36774d1deec4806ee9273e25a059f9ac1f9e (patch) (side-by-side diff) | |
tree | b672261ed87ae17b33e4ed47a70d4a82fccb8406 | |
parent | 10cd03eb7108ef66614790ba2b5482a9bc9a87fd (diff) | |
download | opie-7edc36774d1deec4806ee9273e25a059f9ac1f9e.zip opie-7edc36774d1deec4806ee9273e25a059f9ac1f9e.tar.gz opie-7edc36774d1deec4806ee9273e25a059f9ac1f9e.tar.bz2 |
using now QInterfacePtr as Simon suggested, and another leak fix in datebook plugin
-rw-r--r-- | core/pim/today/plugins/datebook/datebookpluginimpl.cpp | 1 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 12 |
2 files changed, 7 insertions, 6 deletions
diff --git a/core/pim/today/plugins/datebook/datebookpluginimpl.cpp b/core/pim/today/plugins/datebook/datebookpluginimpl.cpp index 4159b49..45736bb 100644 --- a/core/pim/today/plugins/datebook/datebookpluginimpl.cpp +++ b/core/pim/today/plugins/datebook/datebookpluginimpl.cpp @@ -17,16 +17,17 @@ #include "datebookplugin.h" #include "datebookpluginimpl.h" DatebookPluginImpl::DatebookPluginImpl() { datebookPlugin = new DatebookPlugin(); } DatebookPluginImpl::~DatebookPluginImpl() { + delete datebookPlugin; } TodayPluginObject* DatebookPluginImpl::guiPart() { return datebookPlugin; } QRESULT DatebookPluginImpl::queryInterface( const QUuid & uuid, QUnknownInterface **iface ) { *iface = 0; diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 01ef02d..1b31cfd 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp @@ -34,18 +34,19 @@ #include <qlayout.h> #include <qhbox.h> #include <opie/otabwidget.h> #include <qdialog.h> #include <qwhatsthis.h> struct TodayPlugin { + TodayPlugin() : library( 0 ), iface( 0 ), guiPart( 0 ), guiBox( 0 ) {} QLibrary *library; - TodayPluginInterface *iface; + QInterfacePtr<TodayPluginInterface> iface; TodayPluginObject *guiPart; QWidget *guiBox; QString name; bool active; bool excludeRefresh; int pos; }; @@ -156,38 +157,37 @@ void Today::loadPlugins() { } else { (*tit).library->unload(); delete (*tit).library; } } pluginList.clear(); } - QString path = QPEApplication::qpeDir() + "/plugins/today"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; QMap<QString, TodayPlugin> tempList; for ( it = list.begin(); it != list.end(); ++it ) { - TodayPluginInterface *iface = 0; - QLibrary *lib = new QLibrary( path + "/" + *it ); +// TodayPluginInterface *iface = 0; + QInterfacePtr<TodayPluginInterface> iface; + QLibrary *lib = new QLibrary( path + "/" + *it ); qDebug( "querying: %s", QString( path + "/" + *it ).latin1() ); if ( lib->queryInterface( IID_TodayPluginInterface, (QUnknownInterface**)&iface ) == QS_OK ) { qDebug( "loading: %s", QString( path + "/" + *it ).latin1() ); qDebug( QString(*it) ); // If plugin is exludes from refresh, get it in the list again here. if ( pluginListRefreshExclude.contains( (*it) ) ) { - // if its not in allApplets list, add it to a layout if ( !m_allApplets.contains( pluginListRefreshExclude[(*it)].name ) ) { qDebug( "NUGASDA" ); layout->addWidget( pluginListRefreshExclude[(*it)].guiBox ); pluginList.append( pluginListRefreshExclude[(*it)] ); } else { tempList.insert( pluginListRefreshExclude[(*it)].name, pluginListRefreshExclude[(*it)] ); qDebug( "TEST2 " + pluginListRefreshExclude[(*it)].name ); @@ -238,17 +238,17 @@ void Today::loadPlugins() { // on first start the list is off course empty if ( m_allApplets.isEmpty() ) { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); } // if plugin is not yet in the list, add it to the layout too - if ( !m_allApplets.contains( plugin.name ) ) { + else if ( !m_allApplets.contains( plugin.name ) ) { layout->addWidget( plugin.guiBox ); pluginList.append( plugin ); } } } else { qDebug( "could not recognize %s", QString( path + "/" + *it ).latin1() ); delete lib; } |