Skip to content

Commit 0eb776d

Browse files
committed
Keep message sheets because setting them as delegates/responders doesn't retain them under ARC.
For brotherbard#5 we need to run under Leaks to detect stuff like this.
1 parent c31a24c commit 0eb776d

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

PBGitXMessageSheet.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ - (void)resizeWindow;
1919

2020
@end
2121

22-
22+
NSMutableArray* allMessageSheets = nil;
2323

2424
@implementation PBGitXMessageSheet
2525

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

6868
[NSApp beginSheet:[self window] modalForWindow:parentWindow modalDelegate:self didEndSelector:nil contextInfo:NULL];
69+
70+
if (!allMessageSheets)
71+
{
72+
allMessageSheets = [[NSMutableArray alloc] init];
73+
}
74+
[allMessageSheets addObject:self];
6975
}
7076

7177

PBRemoteProgressSheet.m

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
NSString * const kGitXProgressErrorDescription = @"PBGitXProgressErrorDescription";
2121
NSString * const kGitXProgressErrorInfo = @"PBGitXProgressErrorInfo";
2222

23-
23+
NSMutableArray* allProgressSheets = nil;
2424

2525
@interface PBRemoteProgressSheet ()
2626

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

112112
[gitTask launch];
113+
114+
if (!allProgressSheets)
115+
{
116+
allProgressSheets = [[NSMutableArray alloc] init];
117+
}
118+
[allProgressSheets addObject:self];
113119
}
114120

115121

0 commit comments

Comments
 (0)