From 0eb776d1d2f526589296f4e9793e29e7944c1033 Mon Sep 17 00:00:00 2001 From: Rowan James Date: Fri, 16 Dec 2011 11:10:44 +1100 Subject: [PATCH] Keep message sheets because setting them as delegates/responders doesn't retain them under ARC. For #5 we need to run under Leaks to detect stuff like this. --- PBGitXMessageSheet.m | 8 +++++++- PBRemoteProgressSheet.m | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/PBGitXMessageSheet.m b/PBGitXMessageSheet.m index 783cc9410..3de61b9c2 100644 --- a/PBGitXMessageSheet.m +++ b/PBGitXMessageSheet.m @@ -19,7 +19,7 @@ - (void)resizeWindow; @end - +NSMutableArray* allMessageSheets = nil; @implementation PBGitXMessageSheet @@ -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]; } diff --git a/PBRemoteProgressSheet.m b/PBRemoteProgressSheet.m index 99a7c56e5..45337a699 100644 --- a/PBRemoteProgressSheet.m +++ b/PBRemoteProgressSheet.m @@ -20,7 +20,7 @@ NSString * const kGitXProgressErrorDescription = @"PBGitXProgressErrorDescription"; NSString * const kGitXProgressErrorInfo = @"PBGitXProgressErrorInfo"; - +NSMutableArray* allProgressSheets = nil; @interface PBRemoteProgressSheet () @@ -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]; }