mirror of
https://github.com/exyte/Macaw.git
synced 2024-10-26 04:49:57 +03:00
Merge pull request #599 from exyte/bug/597-Fix-memory-leak
Fix #597: Memory leak, close graphics context in doFindNode method
This commit is contained in:
commit
cbe4a5a0c3
@ -242,11 +242,13 @@ open class MacawView: MView, MGestureRecognizerDelegate {
|
||||
|
||||
private func doFindNode(location: CGPoint) -> NodePath? {
|
||||
MGraphicsBeginImageContextWithOptions(self.bounds.size, false, 1.0)
|
||||
if let ctx = MGraphicsGetCurrentContext() {
|
||||
return doFindNode(location: location, ctx: ctx)
|
||||
defer {
|
||||
MGraphicsEndImageContext()
|
||||
}
|
||||
MGraphicsEndImageContext()
|
||||
return .none
|
||||
guard let ctx = MGraphicsGetCurrentContext() else {
|
||||
return .none
|
||||
}
|
||||
return doFindNode(location: location, ctx: ctx)
|
||||
}
|
||||
|
||||
// MARK: - Touches
|
||||
|
Loading…
Reference in New Issue
Block a user