[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Thu Jul 15 06:41:33 CEST 2004
CVS commit by staikos:
don't crash
CCMAIL: 85209-done at bugs.kde.org
M +14 -4 kstdatasource.cpp 1.23
--- kdeextragear-2/kst/kst/kstdatasource.cpp #1.22:1.23
@@ -26,4 +26,5 @@
#include <kservicetype.h>
+#include <qdeepcopy.h>
#include <qfile.h>
#include <qstylesheet.h>
@@ -42,7 +43,13 @@ namespace KST {
assert(service);
_plugLib = service->property("X-Kst-Plugin-Library").toString();
+ //kdDebug() << "Create plugin " << (void*)this << " " << service->property("Name").toString() << endl;
}
- virtual ~Plugin() { if (_lib) { _lib->unload(); } }
+ virtual ~Plugin() {
+ //kdDebug() << "Destroy plugin " << (void*)this << " " << service->property("Name").toString() << endl;
+ if (_lib) {
+ _lib->unload();
+ }
+ }
KstDataSource *create(const QString& filename, const QString& type = QString::null) const {
@@ -144,5 +151,6 @@ static void scanPlugins() {
// This cleans up plugins that have been uninstalled and adds in new ones.
// Since it is a shared pointer it can't dangle anywhere.
- pluginInfo = tmpList;
+ pluginInfo.clear();
+ pluginInfo = QDeepCopy<KST::PluginInfoList>(tmpList);
}
@@ -168,6 +176,8 @@ static KstDataSourcePtr findPluginFor(co
scanPlugins();
+ KST::PluginInfoList info = QDeepCopy<KST::PluginInfoList>(pluginInfo);
+
if (!type.isEmpty()) {
- for (KST::PluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
+ for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) {
if ((*it)->provides(type)) {
plugin = (*it)->create(filename, type);
@@ -179,5 +189,5 @@ static KstDataSourcePtr findPluginFor(co
}
- for (KST::PluginInfoList::ConstIterator it = pluginInfo.begin(); it != pluginInfo.end(); ++it) {
+ for (KST::PluginInfoList::ConstIterator it = info.begin(); it != info.end(); ++it) {
if ((*it)->understands(filename)) {
plugin = (*it)->create(filename);
More information about the Kst
mailing list