Fix constructions of QJSEngine objects

The private class is not empty anymore, so calling the wrong
constructor would lead to memory corruption

Change-Id: I6d477fc63bba46be733273f548397c2a50ef2bf4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
This commit is contained in:
Lars Knoll 2015-01-01 16:33:04 +01:00 committed by Lars Knoll
parent 07d714f3ca
commit 645d9e9632
1 changed files with 3 additions and 2 deletions

View File

@ -165,7 +165,8 @@ QT_BEGIN_NAMESPACE
\l{ECMA-262}, Section 15.1.
*/
QJSEngine::QJSEngine()
: d(new QV8Engine(this))
: QObject(*new QJSEnginePrivate, 0)
, d(new QV8Engine(this))
{
}
@ -177,7 +178,7 @@ QJSEngine::QJSEngine()
*/
QJSEngine::QJSEngine(QObject *parent)
: QObject(parent)
: QObject(*new QJSEnginePrivate, parent)
, d(new QV8Engine(this))
{
}