diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-27 14:22:55 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-27 14:22:55 (GMT) |
commit | 3f626c3e14f2fe5fdecc38d4265d74f8315b3490 (patch) | |
tree | 357b32156e211a33841e44b7a224313c7072ee46 /src/script | |
parent | 57ce77e953b618739f6f1aec67f8e0de97e05b08 (diff) | |
parent | 6396e7a15079cb157caef319348a0bcd0b95a6a7 (diff) | |
download | Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.zip Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.tar.gz Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.tar.bz2 |
Merge remote branch 'origin/master' into 4.7
Conflicts:
src/corelib/kernel/qmetatype.cpp
src/declarative/graphicsitems/qdeclarativeevents.cpp
src/declarative/graphicsitems/qdeclarativeflickable.cpp
src/declarative/graphicsitems/qdeclarativegridview.cpp
src/declarative/qml/qdeclarativescript.cpp
src/declarative/util/qdeclarativeanimation.cpp
src/declarative/util/qdeclarativebehavior.cpp
src/declarative/util/qdeclarativeeasefollow.cpp
src/declarative/util/qdeclarativefontloader.cpp
src/declarative/util/qdeclarativelistmodel.cpp
src/declarative/util/qdeclarativespringfollow.cpp
src/declarative/util/qdeclarativestategroup.cpp
src/declarative/util/qdeclarativesystempalette.cpp
src/declarative/util/qdeclarativetimer.cpp
src/declarative/util/qmlstateoperations.cpp
src/multimedia/qml/qdeclarativeaudio.cpp
src/multimedia/qml/qdeclarativevideo.cpp
Diffstat (limited to 'src/script')
-rw-r--r-- | src/script/api/qscriptengine.cpp | 2 | ||||
-rw-r--r-- | src/script/api/qscriptengine_p.h | 12 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 98a24d0..d2e96d1 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -844,7 +844,7 @@ static QScriptValue __setupPackage__(QScriptContext *ctx, QScriptEngine *eng) } // namespace QScript QScriptEnginePrivate::QScriptEnginePrivate() - : registeredScriptValues(0), freeScriptValues(0), + : registeredScriptValues(0), freeScriptValues(0), freeScriptValuesCount(0), registeredScriptStrings(0), inEval(false) { qMetaTypeId<QScriptValue>(); diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 79294fe..d0d020a 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -354,6 +354,8 @@ public: int agentLineNumber; QScriptValuePrivate *registeredScriptValues; QScriptValuePrivate *freeScriptValues; + static const int maxFreeScriptValues = 256; + int freeScriptValuesCount; QScriptStringPrivate *registeredScriptStrings; QHash<int, QScriptTypeInfo*> m_typeInfos; int processEventsInterval; @@ -521,6 +523,7 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz if (freeScriptValues) { QScriptValuePrivate *p = freeScriptValues; freeScriptValues = p->next; + --freeScriptValuesCount; return p; } return reinterpret_cast<QScriptValuePrivate*>(qMalloc(size)); @@ -528,8 +531,13 @@ inline QScriptValuePrivate *QScriptEnginePrivate::allocateScriptValuePrivate(siz inline void QScriptEnginePrivate::freeScriptValuePrivate(QScriptValuePrivate *p) { - p->next = freeScriptValues; - freeScriptValues = p; + if (freeScriptValuesCount < maxFreeScriptValues) { + p->next = freeScriptValues; + freeScriptValues = p; + ++freeScriptValuesCount; + } else { + qFree(p); + } } inline void QScriptEnginePrivate::registerScriptValue(QScriptValuePrivate *value) |