Fix crash when loading cache files generated ahead of time
The offset of the runtimeStrings array differed between a V4_BOOTSTRAP build and the regular library build. This is an intermediate fix until QTBUG-58666 is fixed properly. Change-Id: Id1310ffa82f1079c1acef7730db41186fa62610f Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
d5d12e1d6f
commit
84a07bebc9
|
@ -95,8 +95,8 @@ static QString cacheFilePath(const QUrl &url)
|
||||||
#ifndef V4_BOOTSTRAP
|
#ifndef V4_BOOTSTRAP
|
||||||
CompilationUnit::CompilationUnit()
|
CompilationUnit::CompilationUnit()
|
||||||
: data(0)
|
: data(0)
|
||||||
, engine(0)
|
|
||||||
, runtimeStrings(0)
|
, runtimeStrings(0)
|
||||||
|
, engine(0)
|
||||||
, runtimeLookups(0)
|
, runtimeLookups(0)
|
||||||
, runtimeRegularExpressions(0)
|
, runtimeRegularExpressions(0)
|
||||||
, runtimeClasses(0)
|
, runtimeClasses(0)
|
||||||
|
|
|
@ -816,13 +816,11 @@ struct Q_QML_PRIVATE_EXPORT CompilationUnit : public QQmlRefCount
|
||||||
// Called only when building QML, when we build the header for JS first and append QML data
|
// Called only when building QML, when we build the header for JS first and append QML data
|
||||||
virtual QV4::CompiledData::Unit *createUnitData(QmlIR::Document *irDocument);
|
virtual QV4::CompiledData::Unit *createUnitData(QmlIR::Document *irDocument);
|
||||||
|
|
||||||
#ifndef V4_BOOTSTRAP
|
|
||||||
ExecutionEngine *engine;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QV4::Heap::String **runtimeStrings; // Array
|
QV4::Heap::String **runtimeStrings; // Array
|
||||||
|
|
||||||
#ifndef V4_BOOTSTRAP
|
#ifndef V4_BOOTSTRAP
|
||||||
|
ExecutionEngine *engine;
|
||||||
|
|
||||||
QString fileName() const { return data->stringAt(data->sourceFileIndex); }
|
QString fileName() const { return data->stringAt(data->sourceFileIndex); }
|
||||||
QUrl url() const { if (m_url.isNull) m_url = QUrl(fileName()); return m_url; }
|
QUrl url() const { if (m_url.isNull) m_url = QUrl(fileName()); return m_url; }
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include "qqmldebugserviceinterfaces_p.h"
|
#include "qqmldebugserviceinterfaces_p.h"
|
||||||
|
|
||||||
#include <private/qqmlengine_p.h>
|
#include <private/qqmlengine_p.h>
|
||||||
|
#include <private/qv4compileddata_p.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -181,12 +182,12 @@ bool QQmlDebuggingEnabler::startDebugConnector(const QString &pluginName,
|
||||||
return connector ? connector->open(configuration) : false;
|
return connector ? connector->open(configuration) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum { HookCount = 3 };
|
enum { HookCount = 4 };
|
||||||
|
|
||||||
// Only add to the end, and bump version if you do.
|
// Only add to the end, and bump version if you do.
|
||||||
quintptr Q_QML_EXPORT qtDeclarativeHookData[] = {
|
quintptr Q_QML_EXPORT qtDeclarativeHookData[] = {
|
||||||
// Version of this Array. Bump if you add to end.
|
// Version of this Array. Bump if you add to end.
|
||||||
1,
|
2,
|
||||||
|
|
||||||
// Number of entries in this array.
|
// Number of entries in this array.
|
||||||
HookCount,
|
HookCount,
|
||||||
|
@ -194,7 +195,10 @@ quintptr Q_QML_EXPORT qtDeclarativeHookData[] = {
|
||||||
// TypeInformationVersion, an integral value, bumped whenever private
|
// TypeInformationVersion, an integral value, bumped whenever private
|
||||||
// object sizes or member offsets that are used in Qt Creator's
|
// object sizes or member offsets that are used in Qt Creator's
|
||||||
// data structure "pretty printing" change.
|
// data structure "pretty printing" change.
|
||||||
2
|
3,
|
||||||
|
|
||||||
|
// Version of the cache data.
|
||||||
|
QV4_DATA_STRUCTURE_VERSION
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_STATIC_ASSERT(HookCount == sizeof(qtDeclarativeHookData) / sizeof(qtDeclarativeHookData[0]));
|
Q_STATIC_ASSERT(HookCount == sizeof(qtDeclarativeHookData) / sizeof(qtDeclarativeHookData[0]));
|
||||||
|
|
|
@ -109,7 +109,7 @@ void tst_toolsupport::offsets_data()
|
||||||
= QTest::newRow("CompiledData::CompilationUnit::runtimeStrings")
|
= QTest::newRow("CompiledData::CompilationUnit::runtimeStrings")
|
||||||
<< pmm_to_offsetof(&QV4::CompiledData::CompilationUnit::runtimeStrings);
|
<< pmm_to_offsetof(&QV4::CompiledData::CompilationUnit::runtimeStrings);
|
||||||
|
|
||||||
data << 16 << 32;
|
data << 12 << 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue