From b984d7f192a0e84889899cf65fa6d6d368b0ee7e Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 31 Oct 2010 10:23:52 -0400 Subject: [PATCH] Stop crashing with EXC_BAD_ACCESS when expanding properties beyond the fetched depth. --- Source/DebuggerConnection.h | 3 +-- Source/DebuggerProcessor.h | 4 ++-- Source/DebuggerProcessor.m | 1 + Source/NSXMLElementAdditions.m | 7 ++++--- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/DebuggerConnection.h b/Source/DebuggerConnection.h index 3e374eb..daf7db3 100644 --- a/Source/DebuggerConnection.h +++ b/Source/DebuggerConnection.h @@ -20,7 +20,7 @@ @class LoggingController; // This class is the lowest level component to the network. It deals with all -// the intracies of network and stream programming. Almost all the work this +// the intricacies of network and stream programming. Almost all the work this // class does is on a background thread, which is created when the connection is // asked to connect and shutdown when asked to close. @interface DebuggerConnection : NSObject @@ -113,4 +113,3 @@ - (void)errorEncountered:(NSString*)error; @end - diff --git a/Source/DebuggerProcessor.h b/Source/DebuggerProcessor.h index cba3d83..dee8a2e 100644 --- a/Source/DebuggerProcessor.h +++ b/Source/DebuggerProcessor.h @@ -22,8 +22,8 @@ @protocol DebuggerProcessorDelegate; -// The DebuggerConnection is the communication layer between the application -// and the Xdebug engine. Clients can issue debugger commands using this class, +// The DebuggerProcessor is the communication layer between the application +// and the back-end debugger. Clients issue debugger commands via this class, // which are sent in an asynchronous manner. Reads are also asynchronous and // the primary client of this class should set itself as the delegate. The // primary unit that this class deals with is the StackFrame; clients should diff --git a/Source/DebuggerProcessor.m b/Source/DebuggerProcessor.m index 669d346..e8125e9 100644 --- a/Source/DebuggerProcessor.m +++ b/Source/DebuggerProcessor.m @@ -165,6 +165,7 @@ { NSNumber* tx = [connection_ sendCommandWithFormat:@"property_get -n \"%@\"", property]; [self recordCallback:@selector(propertiesReceived:) forTransaction:tx]; + return [tx intValue]; } - (void)loadStackFrame:(StackFrame*)frame diff --git a/Source/NSXMLElementAdditions.m b/Source/NSXMLElementAdditions.m index 57cba1b..f8a9a63 100644 --- a/Source/NSXMLElementAdditions.m +++ b/Source/NSXMLElementAdditions.m @@ -50,9 +50,10 @@ - (NSArray*)subnodes { NSArray* children = [self children]; - if (![self isLeaf] && [children count] < 1) - { - return [[[(AppDelegate*)[NSApp delegate] debugger] connection] getProperty:[self fullname]]; + // If this node has children but they haven't been loaded from the backend, + // request them asynchronously. + if (![self isLeaf] && [children count] < 1) { + [[[(AppDelegate*)[NSApp delegate] debugger] connection] getProperty:[self fullname]]; } return children; } -- 2.43.5