mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 14:03:55 +02:00
don't allow calls to init, run, evaluate from JS
This commit is contained in:
parent
e2842ab7a4
commit
028eec7164
3 changed files with 7 additions and 6 deletions
|
@ -4255,7 +4255,7 @@ void Application::loadScript(const QString& fileNameString) {
|
|||
QThread* workerThread = new QThread(this);
|
||||
|
||||
// when the worker thread is started, call our engine's run..
|
||||
connect(workerThread, SIGNAL(started()), scriptEngine, SLOT(run()));
|
||||
connect(workerThread, &QThread::started, scriptEngine, &ScriptEngine::run);
|
||||
|
||||
// when the thread is terminated, add both scriptEngine and thread to the deleteLater queue
|
||||
connect(scriptEngine, SIGNAL(finished(const QString&)), scriptEngine, SLOT(deleteLater()));
|
||||
|
|
|
@ -106,6 +106,7 @@ bool ScriptEngine::setScriptContents(const QString& scriptContents) {
|
|||
}
|
||||
|
||||
void ScriptEngine::init() {
|
||||
qDebug() << "Init called!";
|
||||
if (_isInitialized) {
|
||||
return; // only initialize once
|
||||
}
|
||||
|
@ -342,5 +343,4 @@ void ScriptEngine::stopTimer(QTimer *timer) {
|
|||
_timerFunctionMap.remove(timer);
|
||||
delete timer;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -60,13 +60,14 @@ public:
|
|||
|
||||
void setAvatarData(AvatarData* avatarData, const QString& objectName);
|
||||
|
||||
void init();
|
||||
void run(); /// runs continuously until Agent.stop() is called
|
||||
void evaluate(); /// initializes the engine, and evaluates the script, but then returns control to caller
|
||||
|
||||
void timerFired();
|
||||
|
||||
public slots:
|
||||
void init();
|
||||
void run(); /// runs continuously until Agent.stop() is called
|
||||
void stop();
|
||||
void evaluate(); /// initializes the engine, and evaluates the script, but then returns control to caller
|
||||
|
||||
QObject* setInterval(const QScriptValue& function, int intervalMS);
|
||||
QObject* setTimeout(const QScriptValue& function, int timeoutMS);
|
||||
|
|
Loading…
Reference in a new issue