Skip to content

[Swift 2.2.1][Swift runtime] Deallocation of partial class instances for Objective-C-derived classes #1798

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 29, 2016

Conversation

DougGregor
Copy link
Member

What's in this pull request?

Backport the fix for deallocation of partial class instances for Objective-C-derived classes to Swift 2.2. We had fixed this regression from Swift 2.1 on mainline, but it's causing trouble in Swift 2.2 as well.

Resolved bug number: (SR-704)

Teach swift_deallocPartialClassInstance how to deal with classes that
have pure Objective-C classes in their hierarchy. In such cases, we
need to make sure a few things happen:

  1. We deallocate via objc_release rather than
    swift_deallocClassInstance.
  2. We only attempt to find an execute ivar destroyers for
    Swift-defined classes in the hierarchy
  3. When we hit the most-derived pure Objective-C class, make sure that we
    only execute the dealloc of that class and not any of the subclasses
    (which would end up trying to destroy ivars again).

Fixes rdar://problem/25023544 / SR-704.

@swift-ci Please test

…-C-derived classes.

Teach swift_deallocPartialClassInstance how to deal with classes that
have pure Objective-C classes in their hierarchy. In such cases, we
need to make sure a few things happen:

1) We deallocate via objc_release rather than
swift_deallocClassInstance.
2) We only attempt to find an execute ivar destroyers for
Swift-defined classes in the hierarchy
3) When we hit the most-derived pure Objective-C class, make sure that we
only execute the dealloc of that class and not any of the subclasses
(which would end up trying to destroy ivars again).

Fixes rdar://problem/25023544.
@DougGregor
Copy link
Member Author

@tkremenek please consider for a Swift 2.2 update.

@tkremenek
Copy link
Member

@swift-ci test

@tkremenek tkremenek self-assigned this Mar 26, 2016
@tkremenek tkremenek added this to the Swift 2.2.x milestone Mar 26, 2016
@tkremenek tkremenek changed the title [Swift runtime] Deallocation of partial class instances for Objective-C-derived classes [Swift 2.2.1][Swift runtime] Deallocation of partial class instances for Objective-C-derived classes Mar 26, 2016
@DougGregor
Copy link
Member Author

@swift-ci Please test

@tkremenek tkremenek merged commit a4c70eb into swiftlang:swift-2.2-branch Mar 29, 2016
@tkremenek
Copy link
Member

Accepted for Swift 2.2.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants