From 9d9d849d728ea9e71d82bba3657706ec74805442 Mon Sep 17 00:00:00 2001 From: "Aaron J. Seigo" Date: Wed, 18 Nov 2009 22:40:38 +0000 Subject: [PATCH] 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 --- scriptengines/javascript/appletinterface.cpp | 5 +++++ scriptengines/javascript/appletinterface.h | 1 + scriptengines/javascript/simplejavascriptapplet.cpp | 8 +++++++- scriptengines/javascript/simplejavascriptapplet.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/scriptengines/javascript/appletinterface.cpp b/scriptengines/javascript/appletinterface.cpp index eeedb80aa..6b7a4ad5e 100644 --- a/scriptengines/javascript/appletinterface.cpp +++ b/scriptengines/javascript/appletinterface.cpp @@ -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" diff --git a/scriptengines/javascript/appletinterface.h b/scriptengines/javascript/appletinterface.h index fd730ce7c..e96662204 100644 --- a/scriptengines/javascript/appletinterface.h +++ b/scriptengines/javascript/appletinterface.h @@ -171,6 +171,7 @@ enum QtScrollBarPolicy { }; //------------------------------------------------------------------- + Q_INVOKABLE void gc(); Q_INVOKABLE FormFactor formFactor() const; Location location() const; diff --git a/scriptengines/javascript/simplejavascriptapplet.cpp b/scriptengines/javascript/simplejavascriptapplet.cpp index c9ba00a45..1e0be3f16 100644 --- a/scriptengines/javascript/simplejavascriptapplet.cpp +++ b/scriptengines/javascript/simplejavascriptapplet.cpp @@ -42,7 +42,7 @@ #include #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" diff --git a/scriptengines/javascript/simplejavascriptapplet.h b/scriptengines/javascript/simplejavascriptapplet.h index 8c83adcd2..cea3509c1 100644 --- a/scriptengines/javascript/simplejavascriptapplet.h +++ b/scriptengines/javascript/simplejavascriptapplet.h @@ -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();