We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 042b2ba + a026128 commit ebb1cc3Copy full SHA for ebb1cc3
TestFoundation/TestNSKeyedArchiver.swift
@@ -289,13 +289,16 @@ class TestNSKeyedArchiver : XCTestCase {
289
guard let value = unarchiver.decodeObject(of: NSValue.self, forKey: "root") else {
290
return false
291
}
292
- var expectedCharPtr: UnsafeMutablePointer<CChar>? = nil
293
- value.getValue(&expectedCharPtr)
294
-
295
- let s1 = String(cString: charPtr)
296
- let s2 = String(cString: expectedCharPtr!)
297
298
- return s1 == s2
+ return withExtendedLifetime(value) { value in
+ var expectedCharPtr: UnsafeMutablePointer<CChar>? = nil
+ value.getValue(&expectedCharPtr)
+
+ let s1 = String(cString: charPtr)
+ let s2 = String(cString: expectedCharPtr!)
299
300
+ return s1 == s2
301
+ }
302
})
303
304
0 commit comments