cordova-progressIndicator
cordova-progressIndicator copied to clipboard
EXC_BAD_ACCESS causing crash on iOS
Sometimes when calling hide()
after a indicator has already been hidden an EXC_BAD_ACCESS
can occur.
It occurs on line 402 on the first if block check of the hide
method:
- (void)hide:(CDVInvokedUrlCommand*)command
{
if (!self.progressIndicator) {
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
return;
}
[self.progressIndicator hide:YES];
CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:@""];
[self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}
It would be nice if multiple calls to hide()
didn't cause a crash.
I was able to fix this by nilling out the progressIndicator instance variable in the hide method. This prevents the bad access exception for future calls to the hide method.
I've submitted pull request #21 with this change.