diff options
author | Kent Hansen <kent.hansen@nokia.com> | 2010-02-01 13:37:44 (GMT) |
---|---|---|
committer | Kent Hansen <kent.hansen@nokia.com> | 2010-02-01 13:37:44 (GMT) |
commit | ec4eeb8f52b4a5841a3345db415b496adae2dee2 (patch) | |
tree | 457f1171f8598acbeb4a3eae8b8c1a4f7cdfef0c /src/script/api/qscriptprogram.cpp | |
parent | 394b7ae6421afb0e309b6207fa2b1fce2e44426e (diff) | |
download | Qt-ec4eeb8f52b4a5841a3345db415b496adae2dee2.zip Qt-ec4eeb8f52b4a5841a3345db415b496adae2dee2.tar.gz Qt-ec4eeb8f52b4a5841a3345db415b496adae2dee2.tar.bz2 |
Use RefPtr to store QScriptProgram's EvalExecutable
Otherwise we crash with latest WebKit trunk because the
SourceProvider is prematurely destructed.
Diffstat (limited to 'src/script/api/qscriptprogram.cpp')
-rw-r--r-- | src/script/api/qscriptprogram.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/script/api/qscriptprogram.cpp b/src/script/api/qscriptprogram.cpp index c452052..d4a32f4 100644 --- a/src/script/api/qscriptprogram.cpp +++ b/src/script/api/qscriptprogram.cpp @@ -63,7 +63,6 @@ QScriptProgramPrivate::QScriptProgramPrivate(const QString &src, QScriptProgramPrivate::~QScriptProgramPrivate() { - delete _executable; } QScriptProgramPrivate *QScriptProgramPrivate::get(const QScriptProgram &q) @@ -76,17 +75,17 @@ JSC::EvalExecutable *QScriptProgramPrivate::executable(JSC::ExecState *exec, { if (_executable) { if (eng == engine) - return _executable; - delete _executable; + return _executable.get(); + _executable = 0; } WTF::PassRefPtr<QScript::UStringSourceProviderWithFeedback> provider = QScript::UStringSourceProviderWithFeedback::create(sourceCode, fileName, firstLineNumber, eng); sourceId = provider->asID(); JSC::SourceCode source(provider, firstLineNumber); //after construction of SourceCode provider variable will be null. - _executable = new JSC::EvalExecutable(exec, source); + _executable = JSC::EvalExecutable::create(exec, source); engine = eng; isCompiled = false; - return _executable; + return _executable.get(); } /*! |