diff options
author | rowanbeentje <rowan@beent.je> | 2011-08-25 23:03:00 +0000 |
---|---|---|
committer | rowanbeentje <rowan@beent.je> | 2011-08-25 23:03:00 +0000 |
commit | 4f35896057fdc7b6e16c55cf4805177c00967f18 (patch) | |
tree | 78f5f1d515d38361f24501493b3991e14f92acab /Source/SPIndexesController.m | |
parent | bd96d373385c8d2aff108269c1e89063cd48e416 (diff) | |
download | sequelpro-4f35896057fdc7b6e16c55cf4805177c00967f18.tar.gz sequelpro-4f35896057fdc7b6e16c55cf4805177c00967f18.tar.bz2 sequelpro-4f35896057fdc7b6e16c55cf4805177c00967f18.zip |
- Prevent export and indexes controller awakeFromNib: routines from being run multiple times
- Fix crashes and exceptions when using "Use monospaced fonts" or "Display vertical grid lines" preferences after closing at least one window
Diffstat (limited to 'Source/SPIndexesController.m')
-rw-r--r-- | Source/SPIndexesController.m | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index 8058ff3f..92a0ddf6 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -79,6 +79,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; #endif if ((self = [super initWithWindowNibName:nibName])) { + _mainNibLoaded = NO; table = @""; fields = [[NSMutableArray alloc] init]; @@ -114,6 +115,11 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; */ - (void)awakeFromNib { + + // As this controller also loads its own nib, it may call awakeFromNib multiple times; perform setup only once. + if (_mainNibLoaded) return; + _mainNibLoaded = YES; + #ifndef SP_REFACTOR /* patch */ // Set the index tables view's vertical gridlines if required [indexesTableView setGridStyleMask:([prefs boolForKey:SPDisplayTableViewVerticalGridlines]) ? NSTableViewSolidVerticalGridLineMask : NSTableViewGridNone]; @@ -1018,6 +1024,10 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; if (indexedFields) [indexedFields release], indexedFields = nil; +#ifndef SP_REFACTOR + [prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines]; +#endif + [super dealloc]; } |