diff options
author | Fabian Kosmale <[email protected]> | 2024-06-05 15:30:31 +0200 |
---|---|---|
committer | Fabian Kosmale <[email protected]> | 2024-06-17 17:35:32 +0200 |
commit | 29361b881592546b259b21af43c8459f692f7a3c (patch) | |
tree | 354d101e22ef0da327093feadae61a68b36857b8 /src/qml/jsruntime/qv4mapobject.cpp | |
parent | 65c306244ed100bf540e6a9bb2198356875bc1ed (diff) |
gc: Do not attempt to mark primitive keys of Map/Set
In contrast to a WeakMap/WeakSet, Map and Set also accept primitive
keys, from which we obviously won't be able to obtain a heapObject.
Pick-to: 6.8
Change-Id: I2ceeb54339ff3a3a14424c22b2f49d098cd635cd
Reviewed-by: Ulf Hermann <[email protected]>
Diffstat (limited to 'src/qml/jsruntime/qv4mapobject.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4mapobject.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/qml/jsruntime/qv4mapobject.cpp b/src/qml/jsruntime/qv4mapobject.cpp index 94cac02556..5e7f92a339 100644 --- a/src/qml/jsruntime/qv4mapobject.cpp +++ b/src/qml/jsruntime/qv4mapobject.cpp @@ -217,6 +217,7 @@ ReturnedValue WeakMapPrototype::method_set(const FunctionObject *b, const Value QV4::WriteBarrier::markCustom(scope.engine, [&](QV4::MarkStack *ms) { if (scope.engine->memoryManager->gcStateMachine->state <= GCState::FreeWeakMaps) return; + Q_ASSERT(argv[0].heapObject()); argv[0].heapObject()->mark(ms); if (argc > 1) { if (auto *h = argv[1].heapObject()) @@ -328,7 +329,8 @@ ReturnedValue MapPrototype::method_set(const FunctionObject *b, const Value *thi return scope.engine->throwTypeError(); QV4::WriteBarrier::markCustom(scope.engine, [&](QV4::MarkStack *ms) { - argv[0].heapObject()->mark(ms); + if (auto *h = argv[0].heapObject()) + h->mark(ms); if (argc > 1) { if (auto *h = argv[1].heapObject()) h->mark(ms); |