Skip to content

Commit 763bbf9

Browse files
authored
Merge pull request swiftlang#15114 from gottesmm/pr-ad4fc16a11b85ee79426be965870d165e866a298
[+0-all-args] Swift expects the returned object from bridgeErrorToNSE…
2 parents b39e552 + bb8a273 commit 763bbf9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

stdlib/public/runtime/ErrorObject.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,10 @@ typedef SWIFT_CC(swift)
409409
// initialization of the object happens-before the domain initialization so
410410
// that the domain can be used alone as a flag for the initialization of the
411411
// object.
412-
if (errorObject->domain.load(std::memory_order_acquire))
412+
if (errorObject->domain.load(std::memory_order_acquire)) {
413+
SWIFT_CC_PLUSZERO_GUARD([ns retain]);
413414
return ns;
415+
}
414416

415417
// Otherwise, calculate the domain, code, and user info, and
416418
// initialize the NSError.
@@ -451,6 +453,7 @@ typedef SWIFT_CC(swift)
451453
std::memory_order_acq_rel))
452454
objc_release(domain);
453455

456+
SWIFT_CC_PLUSZERO_GUARD([ns retain]);
454457
return ns;
455458
}
456459

0 commit comments

Comments
 (0)