prep this for fixing the memory leak; at least it doesn't crash anymore, along with my changes to KNS that are upcoming
svn path=/trunk/KDE/kdelibs/; revision=990700
This commit is contained in:
parent
e1f9f6739a
commit
baee782e6f
@ -37,7 +37,8 @@ namespace Plasma
|
|||||||
{
|
{
|
||||||
|
|
||||||
PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
||||||
: Plasma::PackageStructure(parent, QString("Plasmoid"))
|
: Plasma::PackageStructure(parent, QString("Plasmoid")),
|
||||||
|
m_knsEngine(0)
|
||||||
{
|
{
|
||||||
addDirectoryDefinition("images", "images/", i18n("Images"));
|
addDirectoryDefinition("images", "images/", i18n("Images"));
|
||||||
QStringList mimetypes;
|
QStringList mimetypes;
|
||||||
@ -66,6 +67,11 @@ PlasmoidPackage::PlasmoidPackage(QObject *parent)
|
|||||||
setRequired("mainscript", true);
|
setRequired("mainscript", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlasmoidPackage::~PlasmoidPackage()
|
||||||
|
{
|
||||||
|
delete m_knsEngine;
|
||||||
|
}
|
||||||
|
|
||||||
void PlasmoidPackage::pathChanged()
|
void PlasmoidPackage::pathChanged()
|
||||||
{
|
{
|
||||||
KDesktopFile config(path() + "/metadata.desktop");
|
KDesktopFile config(path() + "/metadata.desktop");
|
||||||
@ -79,10 +85,20 @@ void PlasmoidPackage::pathChanged()
|
|||||||
|
|
||||||
void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
|
void PlasmoidPackage::createNewWidgetBrowser(QWidget *parent)
|
||||||
{
|
{
|
||||||
KNS::Engine *engine = new KNS::Engine(parent);
|
//FIXME: memory leak below: it creates a new KNS::Engine every time it's called
|
||||||
if (engine->init("plasmoids.knsrc")) {
|
// however, due to issues in the KNS2 library, reusing the same engine causes crashes :(
|
||||||
engine->downloadDialog(this, SLOT(widgetBrowserFinished()));
|
// if (!m_knsEngine) {
|
||||||
}
|
m_knsEngine = new KNS::Engine(parent);
|
||||||
|
kDebug() << "creating new kns engine" << m_knsEngine;
|
||||||
|
if (!m_knsEngine->init("plasmoids.knsrc")) {
|
||||||
|
delete m_knsEngine;
|
||||||
|
m_knsEngine = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// }
|
||||||
|
|
||||||
|
kDebug() << "successful kns engine" << m_knsEngine;
|
||||||
|
m_knsEngine->downloadDialog(this, SLOT(widgetBrowserFinished()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlasmoidPackage::widgetBrowserFinished()
|
void PlasmoidPackage::widgetBrowserFinished()
|
||||||
|
@ -24,6 +24,11 @@
|
|||||||
#include "plasma/wallpaper.h"
|
#include "plasma/wallpaper.h"
|
||||||
#include "plasma/plasma.h"
|
#include "plasma/plasma.h"
|
||||||
|
|
||||||
|
namespace KNS
|
||||||
|
{
|
||||||
|
class Engine;
|
||||||
|
} // namespace KNS
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -34,6 +39,7 @@ class PlasmoidPackage : public PackageStructure
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit PlasmoidPackage(QObject *parent = 0);
|
explicit PlasmoidPackage(QObject *parent = 0);
|
||||||
|
~PlasmoidPackage();
|
||||||
void createNewWidgetBrowser(QWidget *parent = 0);
|
void createNewWidgetBrowser(QWidget *parent = 0);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -41,6 +47,10 @@ protected:
|
|||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void widgetBrowserFinished();
|
void widgetBrowserFinished();
|
||||||
|
void deleteNewStuffEngine();
|
||||||
|
|
||||||
|
private:
|
||||||
|
KNS::Engine *m_knsEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ThemePackage : public PackageStructure
|
class ThemePackage : public PackageStructure
|
||||||
|
Loading…
Reference in New Issue
Block a user