Skip to content

Commit

Permalink
fix(debugging): Dispatch messages to global GCD queue
Browse files Browse the repository at this point in the history
Incoming debugger messages could cause a breakpoint to be
triggered (e.g. invalid evaluation expression with break on
exceptions turned on). We deadlocked when we didn't dispatch
them and didn't release the current thread, because no other
debugger message could be processed.
  • Loading branch information
mbektchiev committed Aug 30, 2019
1 parent 83c0a63 commit 18a526e
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/debugging/TNSDebugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,18 @@ static void TNSEnableRemoteInspector(int argc, char** argv,
}
return ^(NSString* message, NSError* error) {
if (message) {
// Keep a working copy for calling into the VM after releasing inspectorLock
TNSRuntimeInspector* tempInspector = nil;
@synchronized(inspectorLock()) {
tempInspector = inspector;
}
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// Keep a working copy for calling into the VM after releasing inspectorLock
TNSRuntimeInspector* tempInspector = nil;
@synchronized(inspectorLock()) {
tempInspector = inspector;
}

if (tempInspector) {
// NSLog(@"NativeScript Debugger receiving: %@", message);
[tempInspector dispatchMessage:message];
}
if (tempInspector) {
// NSLog(@"NativeScript Debugger receiving: %@", message);
[tempInspector dispatchMessage:message];
}
});
} else {
clearInspector();

Expand Down

0 comments on commit 18a526e

Please sign in to comment.