Commit 9ebf277e by Maurits van Beusekom Committed by GitHub

Fixed memory dereference error (#640)

parent f8fc0d9f
## 8.1.4+2
* iOS: fixed memory error that occurred on iOS 12.2 and below (see issue [#638](https://github.com/Baseflow/flutter-permission-handler/issues/638)).
## 8.1.4+1 ## 8.1.4+1
* Fix a bug where after allowing the `location` permission and requesting it again would lead to a memory error. * Fix a bug where after allowing the `location` permission and requesting it again would lead to a memory error.
......
...@@ -55,12 +55,16 @@ ...@@ -55,12 +55,16 @@
[requestQueue removeObject:@(permission)]; [requestQueue removeObject:@(permission)];
[self->_strategyInstances removeObject:permissionStrategy]; [self->_strategyInstances removeObject:permissionStrategy];
permissionStrategy = nil;
if (requestQueue.count == 0) { if (requestQueue.count == 0) {
completion(permissionStatusResult); completion(permissionStatusResult);
return;
} }
// Make sure `completion` is called before cleaning up the reference
// otherwise the `completion` block is also dereferenced on iOS 12 and
// below (this is most likely a bug in Objective-C which is solved in
// later versions of the runtime).
permissionStrategy = nil;
}]; }];
} }
} }
......
name: permission_handler name: permission_handler
description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions. description: Permission plugin for Flutter. This plugin provides a cross-platform (iOS, Android) API to request and check permissions.
version: 8.1.4+1 version: 8.1.4+2
homepage: https://github.com/baseflowit/flutter-permission-handler homepage: https://github.com/baseflowit/flutter-permission-handler
flutter: flutter:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment