Summary: | Using indirect file as datasource causes crash | ||
---|---|---|---|
Product: | [Applications] kst | Reporter: | D. V. Wiebe <dvw> |
Component: | general | Assignee: | George Staikos <staikos> |
Status: | RESOLVED FIXED | ||
Severity: | crash | ||
Priority: | NOR | ||
Version: | 1.x | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: |
Description
D. V. Wiebe
2004-07-14 22:15:46 UTC
Reproduced, working on it. CVS commit by staikos: don't crash CCMAIL: 85209-done@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); |