Skip to content

Commit

Permalink
Keep message sheets because setting them as delegates/responders does…
Browse files Browse the repository at this point in the history
…n't retain them under ARC.

For brotherbard#5 we need to run under Leaks to detect stuff like this.
  • Loading branch information
rowanj committed Dec 16, 2011
1 parent c31a24c commit 0eb776d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion PBGitXMessageSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ - (void)resizeWindow;

@end


NSMutableArray* allMessageSheets = nil;

@implementation PBGitXMessageSheet

Expand Down Expand Up @@ -66,6 +66,12 @@ - (void)beginMessageSheetForWindow:(NSWindow *)parentWindow withMessageText:(NSS
[self resizeWindow];

[NSApp beginSheet:[self window] modalForWindow:parentWindow modalDelegate:self didEndSelector:nil contextInfo:NULL];

if (!allMessageSheets)
{
allMessageSheets = [[NSMutableArray alloc] init];
}
[allMessageSheets addObject:self];
}


Expand Down
8 changes: 7 additions & 1 deletion PBRemoteProgressSheet.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
NSString * const kGitXProgressErrorDescription = @"PBGitXProgressErrorDescription";
NSString * const kGitXProgressErrorInfo = @"PBGitXProgressErrorInfo";


NSMutableArray* allProgressSheets = nil;

@interface PBRemoteProgressSheet ()

Expand Down Expand Up @@ -110,6 +110,12 @@ - (void) beginRemoteProgressSheetForArguments:(NSArray *)args title:(NSString *)
taskTimer = [NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(checkTask:) userInfo:nil repeats:YES];

[gitTask launch];

if (!allProgressSheets)
{
allProgressSheets = [[NSMutableArray alloc] init];
}
[allProgressSheets addObject:self];
}


Expand Down

0 comments on commit 0eb776d

Please sign in to comment.