Skip to content

Commit 148f91c

Browse files
authored
Merge pull request #65193 from al45tair/eng/PR-106375185-5.9
[Runtime] Fix swift_weakTakeStrong().
2 parents 4e4518c + a6d2ed6 commit 148f91c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/public/runtime/WeakReference.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,9 @@ class WeakReference {
175175
HeapObject *nativeTakeStrongFromBits(WeakReferenceBits bits) {
176176
auto side = bits.getNativeOrNull();
177177
if (side) {
178+
auto obj = side->tryRetain();
178179
side->decrementWeak();
179-
return side->tryRetain();
180+
return obj;
180181
} else {
181182
return nullptr;
182183
}

0 commit comments

Comments
 (0)