Skip to content
This repository has been archived by the owner on Aug 11, 2020. It is now read-only.

Commit

Permalink
Don't use dispatch_sync if already in the main thread (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Jun 25, 2019
1 parent bb4e66c commit d45ffc3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ios/CDVBarcodeScanner.mm
Expand Up @@ -428,11 +428,16 @@ - (void)barcodeScanSucceeded:(NSString*)text format:(NSString*)format {

//--------------------------------------------------------------------------
- (void)barcodeScanFailed:(NSString*)message {
dispatch_sync(dispatch_get_main_queue(), ^{
dispatch_block_t block = ^{
[self barcodeScanDone:^{
[self.plugin returnError:message callback:self.callback];
}];
});
};
if ([NSThread isMainThread]) {
block();
} else {
dispatch_sync(dispatch_get_main_queue(), block);
}
}

//--------------------------------------------------------------------------
Expand Down

0 comments on commit d45ffc3

Please sign in to comment.