From 65b5adb8a29552177ae62dfde559d2b587acfd45 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 28 Mar 2010 13:27:27 -0400 Subject: [PATCH] Don't crash after pressing the "run" button or at end of script. --- Source/DebuggerConnection.m | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Source/DebuggerConnection.m b/Source/DebuggerConnection.m index 48a24fa..461a960 100644 --- a/Source/DebuggerConnection.m +++ b/Source/DebuggerConnection.m @@ -709,12 +709,14 @@ void SocketAcceptCallback(CFSocketRef socket, */ - (void)debuggerStep:(NSXMLDocument*)response { - [self sendCommandWithCallback:@selector(updateStatus:) format:@"status"]; - NSString* command = [[[response rootElement] attributeForName:@"command"] stringValue]; + [self updateStatus:response]; + if (!connected) + return; // If this is the run command, tell the delegate that a bunch of updates // are coming. Also remove all existing stack routes and request a new stack. // TODO: figure out if we can not clobber the stack every time. + NSString* command = [[[response rootElement] attributeForName:@"command"] stringValue]; if (YES || [command isEqualToString:@"run"]) { if ([delegate respondsToSelector:@selector(clobberStack)]) @@ -937,6 +939,9 @@ void SocketAcceptCallback(CFSocketRef socket, */ - (void)sendQueuedWrites { + if (!connected) + return; + [writeQueueLock_ lock]; if (lastReadTransaction_ >= lastWrittenTransaction_ && [queuedWrites_ count] > 0) { -- 2.22.5