Version: 0.98 (using KDE 3.2 BRANCH >= 20040204, Mandrake Linux Cooker i586 - Cooker) Compiler: gcc version 3.3.2 (Mandrake Linux 10.0 3.3.2-6mdk) OS: Linux (i686) release 2.6.3-7mdk kst crashes with a command line such as kst -y FASTSAMP /data/etc/defile.cur where /data/etc/defile.cur is an indirect data source pointing to a dirfile. (I mean, like, it's a text file with the path to a dirfile.) Specifying the dirfile itself works fine. Using the curfile as the data source in the data wizard also causes crash.
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);