We need to keep variables expanded across changing stack positions
authorRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Dec 2008 23:56:01 +0000 (18:56 -0500)
committerRobert Sesek <rsesek@bluestatic.org>
Mon, 1 Dec 2008 23:56:01 +0000 (18:56 -0500)
* Source/DebuggerController.m:
(setRegister:): Removed
(tableViewSelectionDidChange:): Call [expandRegisters]
(expandVariables): New private method
* Source/DebuggerController.h: Header updates

Source/DebuggerController.h
Source/DebuggerController.m

index 2d87323b6c97bf5dc6bdda4d047d6320111a08d1..0bbbf5d94a0b5675969982273c5f454d27d4b7dd 100644 (file)
@@ -43,7 +43,6 @@
 - (void)resetDisplays;
 
 - (void)setError:(NSString *)anError;
-- (void)setRegister:(NSXMLDocument *)reg;
 
 - (IBAction)run:(id)sender;
 - (IBAction)stepIn:(id)sender;
index c4265ef177146ddf7fb9caa6923daa572aa1e14e..c201ffdcf3539f6abadd957f1db44eec0a10f94c 100644 (file)
@@ -23,6 +23,7 @@
 @interface DebuggerController (Private)
 - (void)updateSourceViewer;
 - (void)updateStackViewer;
+- (void)expandVariables;
 @end
 
 @implementation DebuggerController
        [self setError:[[notif userInfo] valueForKey:@"NSString"]];
 }
 
-/**
- * Sets the stack root element so that the NSOutlineView can display it
- */
-- (void)setRegister:(NSXMLDocument *)elm
-{
-       // XXX: Doing anything short of this will cause bindings to crash spectacularly for no reason whatsoever, and
-       //              in seemingly arbitrary places. The class that crashes is _NSKeyValueObservationInfoCreateByRemoving.
-       //              http://boredzo.org/blog/archives/2006-01-29/have-you-seen-this-crash says that this means nothing is
-       //              being observed, but I doubt that he was using an NSOutlineView which seems to be one f!cking piece of
-       //              sh!t when used with NSTreeController. http://www.cocoadev.com/index.pl?NSTreeControllerBugOrDeveloperError
-       //              was the inspiration for this fix (below) but the author says that inserting does not work too well, but
-       //              that's okay for us as we just need to replace the entire thing.
-       [registerController setContent:nil];
-       [registerController setContent:[[elm rootElement] children]];
-       
-       for (int i = 0; i < [registerView numberOfRows]; i++)
-       {
-               NSTreeNode *node = [registerView itemAtRow:i];
-               if ([expandedRegisters containsObject:[[node representedObject] fullname]])
-               {
-                       [registerView expandItem:node];
-               }
-       }
-}
-
 /**
  * Forwards the message to run script execution to the connection
  */
 - (void)tableViewSelectionDidChange:(NSNotification *)notif
 {
        [self updateSourceViewer];
+       [self expandVariables];
 }
 
 /**
 {
        [stackArrayController rearrangeObjects];
        [stackArrayController setSelectionIndex:0];
+       [self expandVariables];
+}
+
+/**
+ * Expands the variables based on the stored set
+ */
+- (void)expandVariables
+{
+       for (int i = 0; i < [registerView numberOfRows]; i++)
+       {
+               NSTreeNode *node = [registerView itemAtRow:i];
+               if ([expandedRegisters containsObject:[[node representedObject] fullname]])
+               {
+                       [registerView expandItem:node];
+               }
+       }
 }
 
 #pragma mark BSSourceView Delegate