diff options
-rw-r--r-- | Source/SPExportController.h | 5 | ||||
-rw-r--r-- | Source/SPExportController.m | 11 | ||||
-rw-r--r-- | Source/SPIndexesController.h | 1 | ||||
-rw-r--r-- | Source/SPIndexesController.m | 10 | ||||
-rw-r--r-- | Source/SPTableStructure.m | 3 |
5 files changed, 28 insertions, 2 deletions
diff --git a/Source/SPExportController.h b/Source/SPExportController.h index 00f0ac62..7a4fcb3c 100644 --- a/Source/SPExportController.h +++ b/Source/SPExportController.h @@ -113,6 +113,11 @@ // Dot IBOutlet NSButton *exportDotForceLowerTableNamesCheck; + + /** + * Whether the awakeFromNib routine has already been run + */ + BOOL mainNibLoaded; /** * Cancellation flag diff --git a/Source/SPExportController.m b/Source/SPExportController.m index f9d5628e..2c93128f 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -83,7 +83,9 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; [self setExportCancelled:NO]; [self setExportToMultipleFiles:YES]; - + + mainNibLoaded = NO; + exportType = SPSQLExport; exportSource = SPTableExport; exportTableCount = 0; @@ -119,7 +121,12 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; * Upon awakening select the first toolbar item */ - (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; + // Select the 'selected tables' option [exportInputPopUpButton selectItemAtIndex:SPTableExport]; diff --git a/Source/SPIndexesController.h b/Source/SPIndexesController.h index b91481bc..7a139125 100644 --- a/Source/SPIndexesController.h +++ b/Source/SPIndexesController.h @@ -67,6 +67,7 @@ IBOutlet NSTextField *indexKeyBlockSizeTextField; #endif + BOOL _mainNibLoaded; NSString *table; NSMutableArray *fields, *indexes, *indexedFields, *supportsLength, *requiresLength; 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]; } diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 0f5222a0..5e308067 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -1703,6 +1703,9 @@ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; +#ifndef SP_REFACTOR + [prefs removeObserver:indexesController forKeyPath:SPUseMonospacedFonts]; +#endif [tableFields release]; [oldRow release]; |