swift
108f7805 - [Runtime] Fatal error if self escapes from deinit.

Commit
3 years ago
[Runtime] Fatal error if self escapes from deinit. When deallocating a class instance, we check the retain count of the instance and error if it's greater than 1. Self is allowed to be temporarily passed to other code from deinit, but there's no way to extend the lifetime of the object. Retaining it no longer extensd the lifetime. If self escapes from deinit, the result is a dangling pointer and eventual crash. Instead of crashing randomly due to a dangling pointer, crash deliberately when destroying an object that has escaped. rdar://93848484
Author
Committer
Parents
Loading