Skip to content

Commit

Permalink
Prevent a memory leak in a nested function (#441)
Browse files Browse the repository at this point in the history
To fix a crash "Layout.swift: Fatal error: Attempted to read an unowned reference but the object was already deallocated"  which is reported at issue #440.
  • Loading branch information
scenee authored Feb 23, 2021
1 parent 1bd2e60 commit 561d783
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Sources/Core.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ class Core: NSObject, UIGestureRecognizerDelegate {
interruptAnimationIfNeeded()

if animated {
func updateScrollView() {
let updateScrollView: () -> Void = { [weak self] in
guard let self = self else { return }
if self.state == self.layoutAdapter.edgeMostState, abs(self.layoutAdapter.offsetFromEdgeMost) <= 1.0 {
self.unlockScrollView()
} else {
Expand Down

0 comments on commit 561d783

Please sign in to comment.