Skip to content
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

Fix the bug I introduced in #1030 #trivial #1035

Merged
merged 1 commit into from
Jul 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Source/Layout/ASLayout.mm
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ - (void)dealloc
{
if (_retainSublayoutElements.load()) {
for (ASLayout *sublayout in _sublayouts) {
CFRelease((__bridge CFTypeRef)sublayout);
// We retained this, so there's no risk of it deallocating on us.
if (let cfElement = (__bridge CFTypeRef)sublayout->_layoutElement) {
CFRelease(cfElement);
}
}
}
}
Expand All @@ -186,7 +189,8 @@ - (void)retainSublayoutElements
}

for (ASLayout *sublayout in _sublayouts) {
CFRetain((__bridge CFTypeRef)sublayout->_layoutElement);
// CFBridgingRetain atomically casts and retains. We need the atomicity.
CFBridgingRetain(sublayout->_layoutElement);
}
}

Expand Down