add a delayed gc() for convenience so one doesn't have to set up a timer in the script to do that (leaving the timer itself behind in all likliehood *sigh*)

svn path=/trunk/KDE/kdebase/runtime/; revision=1051138
This commit is contained in:
Aaron J. Seigo 2009-11-18 22:40:38 +00:00
parent 8ff52246b7
commit 9d9d849d72
4 changed files with 14 additions and 1 deletions

View File

@ -336,4 +336,9 @@ void AppletInterface::debug(const QString &msg)
kDebug() << msg;
}
void AppletInterface::gc()
{
QTimer::singleShot(0, m_appletScriptEngine, SLOT(collectGarbage()));
}
#include "appletinterface.moc"

View File

@ -171,6 +171,7 @@ enum QtScrollBarPolicy {
};
//-------------------------------------------------------------------
Q_INVOKABLE void gc();
Q_INVOKABLE FormFactor formFactor() const;
Location location() const;

View File

@ -42,7 +42,7 @@
#include <Plasma/VideoWidget>
#include "appletinterface.h"
#include "qtgui/filedialogproxy.h"
#include "simplebindings/filedialogproxy.h"
using namespace Plasma;
@ -915,6 +915,12 @@ QScriptValue SimpleJavaScriptApplet::variantToScriptValue(QVariant var)
return ::variantToScriptValue(m_engine, var);
}
void SimpleJavaScriptApplet::collectGarbage()
{
kDebug();
m_engine->collectGarbage();
}
K_EXPORT_PLASMA_APPLETSCRIPTENGINE(qscriptapplet, SimpleJavaScriptApplet)
#include "simplejavascriptapplet.moc"

View File

@ -57,6 +57,7 @@ public slots:
void dataUpdated( const QString &name, const Plasma::DataEngine::Data &data );
void configChanged();
void executeAction(const QString &name);
void collectGarbage();
private:
bool importExtensions();