Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: jjac/TreeControllerTest
base: a91dafb813
...
head fork: jjac/TreeControllerTest
compare: ed59a7afe0
Checking mergeability… Don't worry, you can still create the pull request.
  • 7 commits
  • 11 files changed
  • 0 commit comments
  • 1 contributor
View
4 README.mdown
@@ -10,7 +10,7 @@ Then object A will still not be deallocated because NSTreeController seems to no
### Executing Use Case in the Test App
-1. Run the app with the "Allocations" instrument
+1. Run the app in Instruments with the "Allocations" instrument
2. Select the "Statistics" view; sort by category column
@@ -24,7 +24,7 @@ Then object A will still not be deallocated because NSTreeController seems to no
7. Now select the "I am number ..." node
-8. You will find in instruments that the total number of live JJNodes has increased by one. This is wrong.
+8. You will find in instruments that as soon as the "I am number ..." node changes to a new number, the total number of live JJNodes has increased by one. This is wrong.
### Workaround
View
BIN  Sample Instruments Run.trace/Trace1.run/event_data_1930.oa
Binary file not shown
View
BIN  Sample Instruments Run.trace/form.template
Binary file not shown
View
BIN  Sample Instruments Run.trace/instrument_data/C907F37C-D485-4419-BF88-E23E8671A102/run_data/1.run.zip
Binary file not shown
View
BIN  Sample Instruments Run.trace/instrument_data/EF4DC038-8A17-421A-8050-39DD0980C06F/run_data/1.run.zip
Binary file not shown
View
BIN  Sample Instruments Run.trace/shared_data/1.run/0FE55731-E9B7-427B-8B66-969D886C01D0.zip
Binary file not shown
View
BIN  Sample Instruments Run.trace/shared_data/1.run/D2D0B0C0-2B20-430A-A52B-89C4DFCC5988.zip
Binary file not shown
View
2  TreeControllerTest/AppDelegate.h
@@ -14,4 +14,6 @@
@property (assign) IBOutlet NSWindow *window;
@property (nonatomic, retain) IBOutlet NSTreeController *treeController;
@property (nonatomic, retain) NSArray *rootNodes;
+@property (nonatomic, retain) NSTimer *stressTestTimer;
+
@end
View
33 TreeControllerTest/AppDelegate.m
@@ -16,9 +16,14 @@ @implementation AppDelegate
@synthesize window = _window;
@synthesize treeController = _treeController;
@synthesize rootNodes = _rootNodes;
+@synthesize stressTestTimer = _stressTestTimer;
- (void)dealloc
{
+ [_stressTestTimer invalidate];
+ [_stressTestTimer release];
+ [_rootNodes release];
+ [_treeController release];
[super dealloc];
}
@@ -31,12 +36,11 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
subSubNode1 = [[[JJNode alloc] init] autorelease];
subSubNode1.value = @"Deep, deep down!";
- // This is the node we will subsequently replace every two seconds
-
subNode1 = [[[JJNode alloc] init] autorelease];
subNode1.value = @"I am first sub-level";
subNode1.subNodes = [NSArray arrayWithObject:subSubNode1];
+ // This is the node we will subsequently replace every two seconds
subNode2 = [[[JJNode alloc] init] autorelease];
subNode2.value = @"I am also first sub-level";
@@ -52,33 +56,12 @@ - (void)applicationDidFinishLaunching:(NSNotification *)aNotification
// Try to provoke the error
#if STRESS_TEST
- [self performSelector:@selector(stressTest) withObject:nil afterDelay:5.0];
+ self.stressTestTimer = [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(replaceNode:) userInfo:nil repeats:YES];
#endif
}
-- (void) stressTest
-{
- [NSThread detachNewThreadSelector:@selector(_stressTest) toTarget:self withObject:nil];
-}
-
-
-- (void) _stressTest
-{
- [self performSelector:@selector(startReplacingNode) withObject:nil afterDelay:2.0];
-
- [[NSRunLoop currentRunLoop] run];
-}
-
-
-- (void) startReplacingNode
-{
- [self performSelectorOnMainThread:@selector(replaceNode) withObject:nil waitUntilDone:NO];
-
- [self performSelector:@selector(startReplacingNode) withObject:nil afterDelay:2.0];
-}
-
-- (void) replaceNode
+- (void)replaceNode:(NSTimer *)timer
{
static NSUInteger counter = 1;
View
2  TreeControllerTest/JJNode.h
@@ -11,7 +11,7 @@
@interface JJNode : NSObject
@property(nonatomic, copy) NSString *value;
-@property(nonatomic, retain) NSMutableArray *subNodes;
+@property(nonatomic, retain) NSArray *subNodes;
- (BOOL) isLeaf;
View
2  TreeControllerTest/JJNode.m
@@ -15,7 +15,7 @@ @implementation JJNode
- (BOOL) isLeaf
{
- return (self.subNodes == nil);
+ return (self.subNodes == nil || [self.subNodes count] == 0);
}
- (void) dealloc

No commit comments for this range

Something went wrong with that request. Please try again.