Skip to content

Commit

Permalink
fix the crash caused by reference to dealloced object after the windo…
Browse files Browse the repository at this point in the history
…w controller is

released.
  • Loading branch information
robin committed Jun 10, 2014
1 parent f2d59d6 commit 25bf110
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion MASPreferencesWindowController.h
Expand Up @@ -30,7 +30,7 @@ __attribute__((__visibility__("default")))
@property (nonatomic, readonly) NSUInteger indexOfSelectedController;
@property (nonatomic, readonly, retain) NSViewController <MASPreferencesViewController> *selectedViewController;
@property (nonatomic, readonly) NSString *title;
@property (nonatomic, retain) IBOutlet NSToolbar *toolbar;
@property (nonatomic, weak) IBOutlet NSToolbar *toolbar;

- (id)initWithViewControllers:(NSArray *)viewControllers;
- (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title;
Expand Down
5 changes: 5 additions & 0 deletions MASPreferencesWindowController.m
Expand Up @@ -52,6 +52,11 @@ - (void)dealloc
{
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[self window] setDelegate:nil];
for (NSToolbarItem *item in [self.toolbar items]) {
item.target = nil;
item.action = nil;
}
self.toolbar.delegate = nil;
#if !__has_feature(objc_arc)
[_viewControllers release];
[_selectedViewController release];
Expand Down

0 comments on commit 25bf110

Please sign in to comment.