[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdevelop/lib/util
From: Ian Reinhart Geiser <geiseri () kde ! org>
Date: 2005-01-16 1:21:08
Message-ID: 20050116012108.E001F1CF8B () office ! kde ! org
[Download RAW message or body]
CVS commit by geiseri:
Added a timeout to the script engine, so if its not used again in 60 seconds the \
library unloads. This will keep the memory usage down ;)
M +17 -5 kscriptactionmanager.cpp 1.2
M +3 -0 kscriptactionmanager.h 1.2
--- kdevelop/lib/util/kscriptactionmanager.cpp #1.1:1.2
@@ -32,4 +32,6 @@
#include <kaction.h>
#include <qfileinfo.h>
+#include <qtimer.h>
+
static QString _scriptRunner = "KScriptRunner/KScriptRunner";
@@ -55,4 +57,6 @@ KScriptAction::KScriptAction( const QStr
m_action = new KAction(m_scriptName, KShortcut(), this, \
SLOT(activate()), ac, "script"); m_isValid = true;
+ m_timeout = new QTimer(this);
+ connect( m_timeout, SIGNAL(timeout()), SLOT(cleanup()) );
}
}
@@ -134,4 +138,17 @@ void KScriptAction::activate( )
}
m_interface->run(parent(), QVariant());
+ m_timeout->start(60000, FALSE ); // after 1 minute go away
+}
+
+bool KScriptAction::isValid( ) const
+{
+ return m_isValid;
+}
+
+void KScriptAction::cleanup()
+{
+ if(m_interface)
+ delete m_interface;
+ m_interface = 0L;
}
@@ -176,8 +193,3 @@ QPtrList< KAction > KScriptActionManager
}
-bool KScriptAction::isValid( ) const
-{
- return m_isValid;
-}
-
#include "kscriptactionmanager.moc"
--- kdevelop/lib/util/kscriptactionmanager.h #1.1:1.2
@@ -28,4 +28,5 @@ class KAction;
class KActionCollection;
class KScriptInterface;
+class QTimer;
@@ -70,4 +71,5 @@ signals:
private slots:
void activate();
+ void cleanup();
private:
@@ -79,4 +81,5 @@ private:
KScriptInterface *m_interface;
bool m_isValid;
+ QTimer *m_timeout;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic