cordova-progressIndicator icon indicating copy to clipboard operation
cordova-progressIndicator copied to clipboard

EXC_BAD_ACCESS causing crash on iOS

Open Justin-Credible opened this issue 9 years ago • 1 comments

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.

Justin-Credible avatar Jul 10 '15 00:07 Justin-Credible

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.

Justin-Credible avatar Jul 21 '15 03:07 Justin-Credible