diff options
51 files changed, 340 insertions, 443 deletions
diff --git a/Source/SPAboutController.m b/Source/SPAboutController.m index 6a77ae24..c1a5c30a 100644 --- a/Source/SPAboutController.m +++ b/Source/SPAboutController.m @@ -37,17 +37,13 @@ static NSString *SPLicenseFilename = @"License"; @implementation SPAboutController -/** - * Initialisation - */ +#pragma mark - + - (id)init { return [super initWithWindowNibName:@"AboutPanel"]; } -/** - * Initialize interface controls. - */ - (void)awakeFromNib { NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]; @@ -74,6 +70,9 @@ static NSString *SPLicenseFilename = @"License"; [[appLicenseTextView textStorage] appendAttributedString:license]; } +#pragma mark - +#pragma mark IB action methods + /** * Display the license sheet. */ diff --git a/Source/SPBundleCommandRunner.m b/Source/SPBundleCommandRunner.m index 1e8b7ec9..5dd0878a 100644 --- a/Source/SPBundleCommandRunner.m +++ b/Source/SPBundleCommandRunner.m @@ -60,7 +60,6 @@ * @param shellEnvironment A dictionary of environment variable values whose keys are the variable names. * @param path The current directory for the bash command. If path is nil, the current directory is inherited from the process that created the receiver (normally /). * @param theError If not nil and the bash command failed it contains the returned error message as NSLocalizedDescriptionKey - * */ + (NSString *)runBashCommand:(NSString *)command withEnvironment:(NSDictionary*)shellEnvironment atCurrentDirectoryPath:(NSString*)path error:(NSError**)theError { @@ -77,7 +76,6 @@ * @param caller The SPDatabaseDocument which invoked that command to register the command for cancelling; if nil the command won't be registered. * @param name The menu title of the command. * @param theError If not nil and the bash command failed it contains the returned error message as NSLocalizedDescriptionKey - * */ + (NSString *)runBashCommand:(NSString *)command withEnvironment:(NSDictionary*)shellEnvironment atCurrentDirectoryPath:(NSString*)path callerInstance:(id)caller contextInfo:(NSDictionary*)contextInfo error:(NSError**)theError { diff --git a/Source/SPBundleEditorController.h b/Source/SPBundleEditorController.h index acdd60db..8a251d73 100644 --- a/Source/SPBundleEditorController.h +++ b/Source/SPBundleEditorController.h @@ -75,14 +75,16 @@ IBOutlet NSTableView *undeleteTableView; IBOutlet NSTreeController *commandBundleTreeController; + NSMutableArray *touchedBundleArray; + NSMutableArray *deletedDefaultBundles; NSMutableDictionary *commandBundleTree; NSSortDescriptor *sortDescriptor; + NSUndoManager *esUndoManager; NSString *bundlePath; NSString *draggedFilePath; NSString *oldBundleName; - BOOL isTableCellEditing; NSMenu *inputGeneralScopePopUpMenu; NSMenu *inputInputFieldScopePopUpMenu; @@ -108,16 +110,13 @@ NSArray *triggerDataTableArray; NSArray *triggerGeneralArray; NSArray *withBlobDataTableArray; - + NSArray *shellVariableSuggestions; + BOOL doGroupDueToChars; BOOL allowUndo; BOOL wasCutPaste; BOOL selectionChanged; - NSUndoManager *esUndoManager; - - NSArray *shellVariableSuggestions; - - NSMutableArray *deletedDefaultBundles; + BOOL isTableCellEditing; } - (IBAction)inputPopupButtonChanged:(id)sender; diff --git a/Source/SPBundleEditorController.m b/Source/SPBundleEditorController.m index 0b2b42a5..e12931f3 100644 --- a/Source/SPBundleEditorController.m +++ b/Source/SPBundleEditorController.m @@ -70,9 +70,6 @@ @implementation SPBundleEditorController -/** - * Initialisation - */ - (id)init { @@ -87,44 +84,6 @@ return self; } -- (void)dealloc -{ - [inputGeneralScopePopUpMenu release]; - [inputInputFieldScopePopUpMenu release]; - [inputDataTableScopePopUpMenu release]; - [outputGeneralScopePopUpMenu release]; - [outputInputFieldScopePopUpMenu release]; - [outputDataTableScopePopUpMenu release]; - [inputFallbackInputFieldScopePopUpMenu release]; - [triggerInputFieldPopUpMenu release]; - [triggerDataTablePopUpMenu release]; - [triggerGeneralPopUpMenu release]; - [inputNonePopUpMenu release]; - - [inputGeneralScopeArray release]; - [inputInputFieldScopeArray release]; - [inputDataTableScopeArray release]; - [outputGeneralScopeArray release]; - [outputInputFieldScopeArray release]; - [outputDataTableScopeArray release]; - [inputFallbackInputFieldScopeArray release]; - [triggerInputFieldArray release]; - [triggerDataTableArray release]; - [triggerGeneralArray release]; - [withBlobDataTableArray release]; - - [shellVariableSuggestions release]; - [deletedDefaultBundles release]; - - if (touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil; - if (commandBundleTree) [commandBundleTree release], commandBundleTree = nil; - if (sortDescriptor) [sortDescriptor release], sortDescriptor = nil; - if (bundlePath) [bundlePath release], bundlePath = nil; - if (esUndoManager) [esUndoManager release], esUndoManager = nil; - - [super dealloc]; -} - - (void)awakeFromNib { @@ -2140,4 +2099,44 @@ [self _updateBundleMetaSummary]; } +#pragma mark - + +- (void)dealloc +{ + [inputGeneralScopePopUpMenu release]; + [inputInputFieldScopePopUpMenu release]; + [inputDataTableScopePopUpMenu release]; + [outputGeneralScopePopUpMenu release]; + [outputInputFieldScopePopUpMenu release]; + [outputDataTableScopePopUpMenu release]; + [inputFallbackInputFieldScopePopUpMenu release]; + [triggerInputFieldPopUpMenu release]; + [triggerDataTablePopUpMenu release]; + [triggerGeneralPopUpMenu release]; + [inputNonePopUpMenu release]; + + [inputGeneralScopeArray release]; + [inputInputFieldScopeArray release]; + [inputDataTableScopeArray release]; + [outputGeneralScopeArray release]; + [outputInputFieldScopeArray release]; + [outputDataTableScopeArray release]; + [inputFallbackInputFieldScopeArray release]; + [triggerInputFieldArray release]; + [triggerDataTableArray release]; + [triggerGeneralArray release]; + [withBlobDataTableArray release]; + + [shellVariableSuggestions release]; + [deletedDefaultBundles release]; + + if (touchedBundleArray) [touchedBundleArray release], touchedBundleArray = nil; + if (commandBundleTree) [commandBundleTree release], commandBundleTree = nil; + if (sortDescriptor) [sortDescriptor release], sortDescriptor = nil; + if (bundlePath) [bundlePath release], bundlePath = nil; + if (esUndoManager) [esUndoManager release], esUndoManager = nil; + + [super dealloc]; +} + @end diff --git a/Source/SPBundleHTMLOutputController.h b/Source/SPBundleHTMLOutputController.h index 14d2fa64..62eef75d 100644 --- a/Source/SPBundleHTMLOutputController.h +++ b/Source/SPBundleHTMLOutputController.h @@ -36,18 +36,21 @@ { IBOutlet WebView *webView; - NSString *docTitle; - NSString *initHTMLSourceString; - NSString *windowUUID; - NSString *docUUID; - BOOL suppressExceptionAlerting; + NSString *docTitle; + NSString *initHTMLSourceString; + NSString *windowUUID; + NSString *docUUID; + WebPreferences *webPreferences; + + BOOL suppressExceptionAlerting; } @property(readwrite,retain) NSString *docTitle; @property(readwrite,retain) NSString *initHTMLSourceString; @property(readwrite,retain) NSString *windowUUID; @property(readwrite,retain) NSString *docUUID; + @property(assign) BOOL suppressExceptionAlerting; - (IBAction)printDocument:(id)sender; diff --git a/Source/SPBundleHTMLOutputController.m b/Source/SPBundleHTMLOutputController.m index d3dc861d..e9b4ec8c 100644 --- a/Source/SPBundleHTMLOutputController.m +++ b/Source/SPBundleHTMLOutputController.m @@ -41,14 +41,18 @@ #pragma mark - @interface WebView (WebViewPrivate) + - (void) setScriptDebugDelegate:(id) delegate; + @end @interface WebScriptCallFrame : NSObject + - (id)userInfo; - (WebScriptCallFrame *)caller; - (NSString *)functionName; - (id)exception; + @end #pragma mark - @@ -61,12 +65,8 @@ @synthesize docUUID; @synthesize suppressExceptionAlerting; -/** - * Initialisation - */ - (id)init { - if ((self = [super initWithWindowNibName:@"BundleHTMLOutput"])) { [webView setContinuousSpellCheckingEnabled:NO]; [webView setGroupName:@"SequelProBundleHTMLOutput"]; @@ -77,7 +77,6 @@ [webView setShouldUpdateWhileOffscreen:NO]; #endif suppressExceptionAlerting = NO; - } return self; @@ -91,19 +90,15 @@ - (void)displayHTMLContent:(NSString *)content withOptions:(NSDictionary *)displayOptions { - [[self window] orderFront:nil]; [self setInitHTMLSourceString:content]; [[webView mainFrame] loadHTMLString:content baseURL:nil]; - } - (void)displayURLString:(NSString *)url withOptions:(NSDictionary *)displayOptions { - [[self window] makeKeyAndOrderFront:nil]; [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:url]]]; - } - (id)webView @@ -719,12 +714,10 @@ */ - (void)magnifyWithEvent:(NSEvent *)anEvent { - if([anEvent deltaZ]>2.0) [webView makeTextLarger:nil]; else if([anEvent deltaZ]<-2.0) [webView makeTextSmaller:nil]; - } @end diff --git a/Source/SPCSVExporter.m b/Source/SPCSVExporter.m index 2dca9694..8657d766 100644 --- a/Source/SPCSVExporter.m +++ b/Source/SPCSVExporter.m @@ -413,9 +413,8 @@ [pool release]; } -/** - * Dealloc - */ +#pragma mark - + - (void)dealloc { if (csvDataArray) [csvDataArray release], csvDataArray = nil; diff --git a/Source/SPChooseMenuItemDialog.m b/Source/SPChooseMenuItemDialog.m index e874c3b4..a164e858 100644 --- a/Source/SPChooseMenuItemDialog.m +++ b/Source/SPChooseMenuItemDialog.m @@ -41,6 +41,7 @@ @implementation SPChooseMenuItemDialogTextView { } + - (id)init; { if ((self = [super initWithFrame:NSMakeRect(1, 1, 2, 2)])) diff --git a/Source/SPConnectionController.h b/Source/SPConnectionController.h index 80cfd132..e0ed6c54 100644 --- a/Source/SPConnectionController.h +++ b/Source/SPConnectionController.h @@ -31,6 +31,7 @@ // More info at <http://code.google.com/p/sequel-pro/> #import "SPConnectionControllerDelegateProtocol.h" + #import <SPMySQL/SPMySQL.h> @class SPDatabaseDocument, diff --git a/Source/SPConnectionController.m b/Source/SPConnectionController.m index 18899cc5..52cb75bc 100644 --- a/Source/SPConnectionController.m +++ b/Source/SPConnectionController.m @@ -1815,21 +1815,23 @@ static NSComparisonResult _compareFavoritesUsingKey(id favorite1, id favorite2, [(NSView *)favoritesOutlineView display]; } -#pragma mark - - - (void)_documentWillClose:(NSNotification *)notification { cancellingConnection = YES; dbDocument = nil; + if (mySQLConnection) { [mySQLConnection setDelegate:nil]; [NSThread detachNewThreadWithName:@"SPConnectionController close background disconnect" target:mySQLConnection selector:@selector(disconnect) object:nil]; [mySQLConnection autorelease]; mySQLConnection = nil; } + if (sshTunnel) [sshTunnel setConnectionStateChangeSelector:nil delegate:nil], [sshTunnel disconnect], [sshTunnel release]; } +#pragma mark - + - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Source/SPConnectionControllerDataSource.m b/Source/SPConnectionControllerDataSource.m index 17da21c7..daf2c3af 100644 --- a/Source/SPConnectionControllerDataSource.m +++ b/Source/SPConnectionControllerDataSource.m @@ -71,18 +71,17 @@ */ - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)childIndex ofItem:(id)item { - // For the top level of the tree, return the "Quick Connect" child for position zero; // amend all other positions to compensate for the faked position. if (!item) { if (childIndex == 0) { return quickConnectItem; } + childIndex--; } SPTreeNode *node = (item == nil ? favoritesRoot : (SPTreeNode *)item); - return NSArrayObjectAtIndex([node childNodes], childIndex); } diff --git a/Source/SPConnectionControllerInitializer.m b/Source/SPConnectionControllerInitializer.m index 2f4d725e..688b2016 100644 --- a/Source/SPConnectionControllerInitializer.m +++ b/Source/SPConnectionControllerInitializer.m @@ -307,7 +307,8 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; if (favorite == quickConnectItem) { [self _selectNode:favorite]; - } else { + } + else { NSNumber *typeNumber = [[[favorite representedObject] nodeFavorite] objectForKey:SPFavoriteTypeKey]; previousType = typeNumber ? [typeNumber integerValue] : SPTCPIPConnection; @@ -344,11 +345,16 @@ static NSString *SPConnectionViewNibName = @"ConnectionView"; [self _reloadFavoritesViewData]; NSMutableIndexSet *selectionIndexes = [NSMutableIndexSet indexSet]; - for (SPTreeNode *eachNode in selectedFavoriteNodes) { + + for (SPTreeNode *eachNode in selectedFavoriteNodes) + { NSInteger anIndex = [favoritesOutlineView rowForItem:eachNode]; + if (anIndex == -1) continue; + [selectionIndexes addIndex:anIndex]; } + [favoritesOutlineView selectRowIndexes:selectionIndexes byExtendingSelection:NO]; #endif } diff --git a/Source/SPConnectionDelegate.m b/Source/SPConnectionDelegate.m index 70ad76d0..473eef8c 100644 --- a/Source/SPConnectionDelegate.m +++ b/Source/SPConnectionDelegate.m @@ -181,19 +181,23 @@ /** * Close the connection - should be performed on the main thread. */ -- (void) closeAndDisconnect +- (void)closeAndDisconnect { #ifndef SP_REFACTOR NSWindow *theParentWindow = [self parentWindow]; + _isConnected = NO; + if ([[[self parentTabViewItem] tabView] numberOfTabViewItems] == 1) { [theParentWindow orderOut:self]; [theParentWindow setAlphaValue:0.0f]; [theParentWindow performSelector:@selector(close) withObject:nil afterDelay:1.0]; - } else { + } + else { [[[self parentTabViewItem] tabView] performSelector:@selector(removeTabViewItem:) withObject:[self parentTabViewItem] afterDelay:0.5]; [theParentWindow performSelector:@selector(makeKeyAndOrderFront:) withObject:nil afterDelay:0.6]; } + [self parentTabDidClose]; #endif } diff --git a/Source/SPConnectionHandler.m b/Source/SPConnectionHandler.m index 12b59b01..0bbd4409 100644 --- a/Source/SPConnectionHandler.m +++ b/Source/SPConnectionHandler.m @@ -52,7 +52,7 @@ static NSString *SPLocalhostAddress = @"127.0.0.1"; @implementation SPConnectionController (SPConnectionHandler) -/* +/** * Set up the MySQL connection, either through a successful tunnel or directly in the background. */ - (void)initiateMySQLConnection @@ -61,14 +61,18 @@ static NSString *SPLocalhostAddress = @"127.0.0.1"; if (isTestingConnection) { if (sshTunnel) { [progressIndicatorText setStringValue:NSLocalizedString(@"Testing MySQL...", @"MySQL connection test very short status message")]; - } else { + } + else { [progressIndicatorText setStringValue:NSLocalizedString(@"Testing connection...", @"Connection test very short status message")]; } - } else if (sshTunnel) { + } + else if (sshTunnel) { [progressIndicatorText setStringValue:NSLocalizedString(@"MySQL connecting...", @"MySQL connecting very short status message")]; - } else { + } + else { [progressIndicatorText setStringValue:NSLocalizedString(@"Connecting...", @"Generic connecting very short status message")]; } + [progressIndicatorText display]; [connectButton setTitle:NSLocalizedString(@"Cancel", @"cancel button")]; @@ -238,7 +242,7 @@ static NSString *SPLocalhostAddress = @"127.0.0.1"; [pool release]; } -/* +/** * Initiate the SSH connection process. * This should only be called as part of initiateConnection:, and will indirectly * call initiateMySQLConnection if it's successful. @@ -347,7 +351,7 @@ static NSString *SPLocalhostAddress = @"127.0.0.1"; [self addConnectionToDocument]; } -/* +/** * A callback function for the SSH Tunnel setup process - will be called on a connection * state change, allowing connection to fail or proceed as appropriate. If successful, * will call initiateMySQLConnection. @@ -418,7 +422,7 @@ static NSString *SPLocalhostAddress = @"127.0.0.1"; [dbDocument setConnection:mySQLConnection]; } -/* +/** * Ends a connection attempt by stopping the connection animation and * displaying a specified error message. */ diff --git a/Source/SPConsoleMessage.m b/Source/SPConsoleMessage.m index d31f71ac..948cbd69 100644 --- a/Source/SPConsoleMessage.m +++ b/Source/SPConsoleMessage.m @@ -61,9 +61,8 @@ return self; } -/** - * Dealloc. - */ +#pragma mark - + - (void)dealloc { [message release], message = nil; diff --git a/Source/SPContentFilterManager.m b/Source/SPContentFilterManager.m index a0755b92..064f848d 100644 --- a/Source/SPContentFilterManager.m +++ b/Source/SPContentFilterManager.m @@ -75,13 +75,6 @@ return self; } -- (void)dealloc -{ - [contentFilters release]; - - [super dealloc]; -} - /** * Upon awakening bind the query text view's background colour. */ @@ -951,4 +944,13 @@ #endif } +#pragma mark - + +- (void)dealloc +{ + [contentFilters release]; + + [super dealloc]; +} + @end diff --git a/Source/SPCustomQuery.m b/Source/SPCustomQuery.m index 3fac3837..39d2d1e7 100644 --- a/Source/SPCustomQuery.m +++ b/Source/SPCustomQuery.m @@ -3966,9 +3966,6 @@ #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Source/SPDataImport.m b/Source/SPDataImport.m index 027b7113..d00e6023 100644 --- a/Source/SPDataImport.m +++ b/Source/SPDataImport.m @@ -66,9 +66,6 @@ #pragma mark - #pragma mark Initialisation -/** - * Init. - */ - (id)init { if ((self = [super init])) { @@ -105,9 +102,6 @@ return self; } -/** - * UI setup. - */ - (void)awakeFromNib { if (_mainNibLoaded) return; @@ -1744,9 +1738,6 @@ #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { if (fieldMappingImportArray) [fieldMappingImportArray release]; diff --git a/Source/SPDatabaseData.m b/Source/SPDatabaseData.m index 2dbc84dc..6bf72d5e 100644 --- a/Source/SPDatabaseData.m +++ b/Source/SPDatabaseData.m @@ -51,11 +51,8 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, @synthesize serverSupport; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation -/** - * Initialize cache arrays. - */ - (id)init { if ((self = [super init])) { @@ -405,9 +402,6 @@ NSInteger _sortStorageEngineEntry(NSDictionary *itemOne, NSDictionary *itemTwo, #pragma mark - #pragma mark Other -/** - * Deallocate ivars. - */ - (void)dealloc { if (characterSetEncoding) [characterSetEncoding release], characterSetEncoding = nil; diff --git a/Source/SPDatabaseDocument.m b/Source/SPDatabaseDocument.m index 34572750..92e45d18 100644 --- a/Source/SPDatabaseDocument.m +++ b/Source/SPDatabaseDocument.m @@ -5737,100 +5737,7 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; #endif #pragma mark - - -/** - * Dealloc - */ -- (void)dealloc -{ -#ifndef SP_REFACTOR /* Unregister observers */ - // Unregister observers - [prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines]; - [prefs removeObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; - [prefs removeObserver:tableContentInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; - [prefs removeObserver:customQueryInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; - [prefs removeObserver:tableRelationsInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; - [prefs removeObserver:[SPQueryController sharedQueryController] forKeyPath:SPDisplayTableViewVerticalGridlines]; - [prefs removeObserver:tableSourceInstance forKeyPath:SPUseMonospacedFonts]; - [prefs removeObserver:[SPQueryController sharedQueryController] forKeyPath:SPUseMonospacedFonts]; - [prefs removeObserver:tableContentInstance forKeyPath:SPGlobalResultTableFont]; - [prefs removeObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging]; - [prefs removeObserver:self forKeyPath:SPConsoleEnableLogging]; - - if (processListController) { - [processListController close]; - [prefs removeObserver:processListController forKeyPath:SPDisplayTableViewVerticalGridlines]; - } - if (serverVariablesController) [prefs removeObserver:serverVariablesController forKeyPath:SPDisplayTableViewVerticalGridlines]; -#endif - - [[NSNotificationCenter defaultCenter] removeObserver:self]; - [NSObject cancelPreviousPerformRequestsWithTarget:self]; - -#ifndef SP_REFACTOR /* release nib objects */ - for (id retainedObject in nibObjectsToRelease) [retainedObject release]; - - [nibObjectsToRelease release]; - -#endif - - // Tell listeners that this database document is being closed - fixes retain cycles and allows cleanup - [[NSNotificationCenter defaultCenter] postNotificationName:SPDocumentWillCloseNotification object:self]; - - [databaseStructureRetrieval release]; - - [allDatabases release]; - [allSystemDatabases release]; -#ifndef SP_REFACTOR /* dealloc ivars */ - [undoManager release]; - [printWebView release]; -#endif - [selectedDatabaseEncoding release]; -#ifndef SP_REFACTOR - [taskProgressWindow close]; -#endif - - if (selectedTableName) [selectedTableName release]; - if (connectionController) [connectionController release]; -#ifndef SP_REFACTOR /* dealloc ivars */ - if (processListController) [processListController release]; - if (serverVariablesController) [serverVariablesController release]; -#endif - if (mySQLConnection) [mySQLConnection release], mySQLConnection = nil; - if (selectedDatabase) [selectedDatabase release]; - if (mySQLVersion) [mySQLVersion release]; -#ifndef SP_REFACTOR - if (taskDrawTimer) [taskDrawTimer invalidate], [taskDrawTimer release]; - if (taskFadeInStartDate) [taskFadeInStartDate release]; -#endif - if (queryEditorInitString) [queryEditorInitString release]; - if (spfFileURL) [spfFileURL release]; - if (spfPreferences) [spfPreferences release]; - if (spfSession) [spfSession release]; - if (spfDocData) [spfDocData release]; - if (keyChainID) [keyChainID release]; -#ifndef SP_REFACTOR - if (mainToolbar) [mainToolbar release]; -#endif - if (titleAccessoryView) [titleAccessoryView release]; -#ifndef SP_REFACTOR - if (taskProgressWindow) [taskProgressWindow release]; -#endif - if (serverSupport) [serverSupport release]; -#ifndef SP_REFACTOR /* dealloc ivars */ - if (processID) [processID release]; -#endif - if (runningActivitiesArray) [runningActivitiesArray release]; - -#ifdef SP_REFACTOR - if ( tablesListInstance ) [tablesListInstance release]; - if ( customQueryInstance ) [customQueryInstance release]; -#endif - - [super dealloc]; -} - -#pragma mark - +#pragma mark Private API #ifndef SP_REFACTOR /* whole database operations */ @@ -6187,4 +6094,97 @@ static NSString *SPRenameDatabaseAction = @"SPRenameDatabase"; } #endif +#pragma mark - + +- (void)dealloc +{ +#ifndef SP_REFACTOR /* Unregister observers */ + // Unregister observers + [prefs removeObserver:self forKeyPath:SPDisplayTableViewVerticalGridlines]; + [prefs removeObserver:tableSourceInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; + [prefs removeObserver:tableContentInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; + [prefs removeObserver:customQueryInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; + [prefs removeObserver:tableRelationsInstance forKeyPath:SPDisplayTableViewVerticalGridlines]; + [prefs removeObserver:[SPQueryController sharedQueryController] forKeyPath:SPDisplayTableViewVerticalGridlines]; + [prefs removeObserver:tableSourceInstance forKeyPath:SPUseMonospacedFonts]; + [prefs removeObserver:[SPQueryController sharedQueryController] forKeyPath:SPUseMonospacedFonts]; + [prefs removeObserver:tableContentInstance forKeyPath:SPGlobalResultTableFont]; + [prefs removeObserver:[SPQueryController sharedQueryController] forKeyPath:SPConsoleEnableLogging]; + [prefs removeObserver:self forKeyPath:SPConsoleEnableLogging]; + + if (processListController) { + [processListController close]; + [prefs removeObserver:processListController forKeyPath:SPDisplayTableViewVerticalGridlines]; + } + + if (serverVariablesController) { + [prefs removeObserver:serverVariablesController forKeyPath:SPDisplayTableViewVerticalGridlines]; + } +#endif + + [[NSNotificationCenter defaultCenter] removeObserver:self]; + [NSObject cancelPreviousPerformRequestsWithTarget:self]; + +#ifndef SP_REFACTOR /* release nib objects */ + for (id retainedObject in nibObjectsToRelease) [retainedObject release]; + + [nibObjectsToRelease release]; +#endif + + // Tell listeners that this database document is being closed - fixes retain cycles and allows cleanup + [[NSNotificationCenter defaultCenter] postNotificationName:SPDocumentWillCloseNotification object:self]; + + [databaseStructureRetrieval release]; + + [allDatabases release]; + [allSystemDatabases release]; +#ifndef SP_REFACTOR /* dealloc ivars */ + [undoManager release]; + [printWebView release]; +#endif + [selectedDatabaseEncoding release]; +#ifndef SP_REFACTOR + [taskProgressWindow close]; +#endif + + if (selectedTableName) [selectedTableName release]; + if (connectionController) [connectionController release]; +#ifndef SP_REFACTOR /* dealloc ivars */ + if (processListController) [processListController release]; + if (serverVariablesController) [serverVariablesController release]; +#endif + if (mySQLConnection) [mySQLConnection release], mySQLConnection = nil; + if (selectedDatabase) [selectedDatabase release]; + if (mySQLVersion) [mySQLVersion release]; +#ifndef SP_REFACTOR + if (taskDrawTimer) [taskDrawTimer invalidate], [taskDrawTimer release]; + if (taskFadeInStartDate) [taskFadeInStartDate release]; +#endif + if (queryEditorInitString) [queryEditorInitString release]; + if (spfFileURL) [spfFileURL release]; + if (spfPreferences) [spfPreferences release]; + if (spfSession) [spfSession release]; + if (spfDocData) [spfDocData release]; + if (keyChainID) [keyChainID release]; +#ifndef SP_REFACTOR + if (mainToolbar) [mainToolbar release]; +#endif + if (titleAccessoryView) [titleAccessoryView release]; +#ifndef SP_REFACTOR + if (taskProgressWindow) [taskProgressWindow release]; +#endif + if (serverSupport) [serverSupport release]; +#ifndef SP_REFACTOR /* dealloc ivars */ + if (processID) [processID release]; +#endif + if (runningActivitiesArray) [runningActivitiesArray release]; + +#ifdef SP_REFACTOR + if (tablesListInstance) [tablesListInstance release]; + if (customQueryInstance) [customQueryInstance release]; +#endif + + [super dealloc]; +} + @end diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index 2f6af2e7..3fbeada0 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -134,7 +134,6 @@ - (IBAction)viewContent:(id)sender { - // Cancel the selection if currently editing a view and unable to save if (![self couldCommitCurrentViewActions]) { [mainToolbar setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; @@ -150,7 +149,6 @@ - (IBAction)viewQuery:(id)sender { - // Cancel the selection if currently editing a view and unable to save if (![self couldCommitCurrentViewActions]) { [mainToolbar setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; @@ -169,7 +167,6 @@ - (IBAction)viewStatus:(id)sender { - // Cancel the selection if currently editing a view and unable to save if (![self couldCommitCurrentViewActions]) { [mainToolbar setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; @@ -191,7 +188,6 @@ - (IBAction)viewRelations:(id)sender { - // Cancel the selection if currently editing a view and unable to save if (![self couldCommitCurrentViewActions]) { [mainToolbar setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; @@ -207,7 +203,6 @@ - (IBAction)viewTriggers:(id)sender { - // Cancel the selection if currently editing a view and unable to save if (![self couldCommitCurrentViewActions]) { [mainToolbar setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; @@ -238,7 +233,8 @@ if (reloadRequired && selectedTableName) { [tableSourceInstance loadTable:selectedTableName]; - } else { + } + else { structureLoaded = !reload; } } @@ -255,7 +251,8 @@ #endif ) { [tableContentInstance loadTable:selectedTableName]; - } else { + } + else { contentLoaded = !reload; } } @@ -272,7 +269,8 @@ #endif ) { [[extendedTableInfoInstance onMainThread] loadTable:selectedTableName]; - } else { + } + else { statusLoaded = !reload; } } @@ -285,9 +283,11 @@ - (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)tabViewItem { [self startTaskWithDescription:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), [self table]]]; + if ([NSThread isMainThread]) { [NSThread detachNewThreadWithName:@"SPDatabaseViewController view load task" target:self selector:@selector(_loadTabTask:) object:tabViewItem]; - } else { + } + else { [self _loadTabTask:tabViewItem]; } } @@ -352,7 +352,8 @@ // Start a task if (isReloading) { [self startTaskWithDescription:NSLocalizedString(@"Reloading...", @"Reloading table task string")]; - } else { + } + else { [self startTaskWithDescription:[NSString stringWithFormat:NSLocalizedString(@"Loading %@...", @"Loading table task string"), aTable]]; } @@ -363,7 +364,8 @@ // if already on a background thread, make the changes on the existing thread. if ([NSThread isMainThread]) { [NSThread detachNewThreadWithName:@"SPDatabaseViewController table load task" target:self selector:@selector(_loadTableTask) object:nil]; - } else { + } + else { [self _loadTableTask]; } } @@ -534,8 +536,9 @@ #ifndef SP_REFACTOR /* show Create Table syntax */ // Update the "Show Create Syntax" window if it's already opened // according to the selected table/view/proc/func - if([[[self onMainThread] getCreateTableSyntaxWindow] isVisible]) + if ([[[self onMainThread] getCreateTableSyntaxWindow] isVisible]) { [[self onMainThread] showCreateTableSyntax:self]; + } // Add a history entry [spHistoryControllerInstance updateHistoryEntries]; @@ -545,7 +548,9 @@ #ifndef SP_REFACTOR /* triggered commands */ NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; - for(NSString* cmdPath in triggeredCommands) { + + for(NSString* cmdPath in triggeredCommands) + { NSArray *data = [cmdPath componentsSeparatedByString:@"|"]; NSMenuItem *aMenuItem = [[[NSMenuItem alloc] init] autorelease]; [aMenuItem setTag:0]; @@ -582,7 +587,6 @@ } #endif - [loadPool drain]; } diff --git a/Source/SPDocumentController.m b/Source/SPDocumentController.m index f843155a..afc0e9a5 100644 --- a/Source/SPDocumentController.m +++ b/Source/SPDocumentController.m @@ -34,13 +34,11 @@ @implementation SPDocumentController - /** * This is an empty, dummy implementation; this allows Sequel Pro to behave * as if it were a document-based application. */ - /** * Add a dummy implementation of readFromData:ofType:error:, which appears to * be called by the OS in certain situations despite non-document use. @@ -51,6 +49,7 @@ if (outError) { *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; } + return YES; } @@ -62,6 +61,7 @@ if (outError) { *outError = [NSError errorWithDomain:NSOSStatusErrorDomain code:unimpErr userInfo:NULL]; } + return nil; } diff --git a/Source/SPDotExporter.m b/Source/SPDotExporter.m index 3a18b5d2..62cfbc48 100644 --- a/Source/SPDotExporter.m +++ b/Source/SPDotExporter.m @@ -227,9 +227,8 @@ [pool release]; } -/** - * Dealloc - */ +#pragma mark - + - (void)dealloc { delegate = nil; diff --git a/Source/SPExportController.m b/Source/SPExportController.m index 144fd14c..1bbf7f44 100644 --- a/Source/SPExportController.m +++ b/Source/SPExportController.m @@ -81,7 +81,7 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; @synthesize exportCancelled; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation /** * Initializes an instance of SPExportController. @@ -721,24 +721,6 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; } #pragma mark - - -/** - * Dealloc - */ -- (void)dealloc -{ - [tables release], tables = nil; - [exporters release], exporters = nil; - [exportFiles release], exportFiles = nil; - [operationQueue release], operationQueue = nil; - [exportFilename release], exportFilename = nil; - - if (previousConnectionEncoding) [previousConnectionEncoding release], previousConnectionEncoding = nil; - - [super dealloc]; -} - -#pragma mark - #pragma mark Private API /** @@ -1064,4 +1046,19 @@ static const NSString *SPSQLExportDropEnabled = @"SQLExportDropEnabled"; [exportButton setEnabled:[enable boolValue]]; } +#pragma mark - + +- (void)dealloc +{ + [tables release], tables = nil; + [exporters release], exporters = nil; + [exportFiles release], exportFiles = nil; + [operationQueue release], operationQueue = nil; + [exportFilename release], exportFilename = nil; + + if (previousConnectionEncoding) [previousConnectionEncoding release], previousConnectionEncoding = nil; + + [super dealloc]; +} + @end diff --git a/Source/SPExportFile.m b/Source/SPExportFile.m index c4ca6d1a..af3e738a 100644 --- a/Source/SPExportFile.m +++ b/Source/SPExportFile.m @@ -48,7 +48,7 @@ @synthesize exportFileHandleStatus; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation /** * Initialise an autoreleased instance of SPExport using the supplied path. @@ -225,11 +225,7 @@ } #pragma mark - -#pragma mark Other -/** - * Dealloc. - */ - (void)dealloc { if (exportFileHandle) [exportFileHandle release], exportFileHandle = nil; diff --git a/Source/SPExtendedTableInfo.m b/Source/SPExtendedTableInfo.m index 6f4f9ae8..83aa059c 100644 --- a/Source/SPExtendedTableInfo.m +++ b/Source/SPExtendedTableInfo.m @@ -605,20 +605,6 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType"; } #pragma mark - - -/** - * Release connection. - */ -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [connection release], connection = nil; - - [super dealloc]; -} - -#pragma mark - #pragma mark Private API /** @@ -706,4 +692,15 @@ static NSString *SPUpdateTableTypeNewType = @"SPUpdateTableTypeNewType"; return ([value length] > 0) ? value : NSLocalizedString(@"Not available", @"not available label"); } +#pragma mark - + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [connection release], connection = nil; + + [super dealloc]; +} + @end diff --git a/Source/SPFavoritesController.m b/Source/SPFavoritesController.m index 7958fea5..0985d680 100644 --- a/Source/SPFavoritesController.m +++ b/Source/SPFavoritesController.m @@ -466,9 +466,6 @@ static SPFavoritesController *sharedFavoritesController = nil; #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { if (favoritesTree) [favoritesTree release], favoritesTree = nil; diff --git a/Source/SPFieldEditorController.m b/Source/SPFieldEditorController.m index a3c44c64..be9dd145 100644 --- a/Source/SPFieldEditorController.m +++ b/Source/SPFieldEditorController.m @@ -171,8 +171,9 @@ #ifndef SP_REFACTOR // On Mac OSX 10.6 QuickLook runs non-modal thus order out the panel // if still visible - if([[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] isVisible]) + if ([[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] isVisible]) { [[NSClassFromString(@"QLPreviewPanel") sharedPreviewPanel] orderOut:nil]; + } #endif if ( sheetEditData ) [sheetEditData release]; @@ -183,6 +184,7 @@ if ( tmpDirPath ) [tmpDirPath release]; if ( esUndoManager ) [esUndoManager release]; if ( contextInfo ) [contextInfo release]; + [super dealloc]; } @@ -1168,7 +1170,6 @@ */ - (IBAction)bitSheetOperatorButtonWasClicked:(id)sender { - NSUInteger i = 0; NSUInteger aBit; NSUInteger maxBit = (NSUInteger)((maxTextLength > 64) ? 64 : maxTextLength); diff --git a/Source/SPFieldMapperController.m b/Source/SPFieldMapperController.m index 92dffd9f..ec2cf6a0 100644 --- a/Source/SPFieldMapperController.m +++ b/Source/SPFieldMapperController.m @@ -53,17 +53,13 @@ static NSString *SPTableViewValueIndexColumnID = @"value_index"; static NSString *SPTableViewGlobalValueColumnID = @"global_value"; static NSString *SPTableViewSqlColumnID = @"sql"; - @implementation SPFieldMapperController @synthesize sourcePath; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation -/** - * Initialize the field mapper - */ - (id)initWithDelegate:(id)managerDelegate { if ((self = [super initWithWindowNibName:@"DataMigrationDialog"])) { @@ -117,7 +113,6 @@ static NSString *SPTableViewSqlColumnID = @"sql"; - (void)awakeFromNib { - // Set Context Menu [[[fieldMapperTableView menu] itemAtIndex:0] setHidden:YES]; [[[fieldMapperTableView menu] itemAtIndex:1] setHidden:YES]; @@ -235,6 +230,7 @@ static NSString *SPTableViewSqlColumnID = @"sql"; if (fieldMappingTableDefaultValues) [fieldMappingTableDefaultValues release]; if (primaryKeyFields) [primaryKeyFields release]; if (toBeEditedRowIndexes) [toBeEditedRowIndexes release]; + [super dealloc]; } diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index 55a2f356..ad9e094c 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -46,7 +46,7 @@ #pragma mark Setup and teardown /** - * Initialise by creating a blank history array + * Initialise by creating a blank history array. */ - (id) init { diff --git a/Source/SPIndexesController.m b/Source/SPIndexesController.m index f2a26ef1..bd226560 100644 --- a/Source/SPIndexesController.m +++ b/Source/SPIndexesController.m @@ -78,9 +78,6 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; #pragma mark - -/** - * Init. - */ - (id)init { #ifndef SP_REFACTOR @@ -121,9 +118,6 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; return self; } -/** - * Nib awakening. - */ - (void)awakeFromNib { // As this controller also loads its own nib, it may call awakeFromNib multiple times; perform setup only once. @@ -159,7 +153,7 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; } #pragma mark - -#pragma mark IBAction methods +#pragma mark IB action methods /** * Opens the add new index sheet. @@ -586,6 +580,13 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; [indexes setArray:tableIndexes]; } +#ifdef SP_REFACTOR +- (void)setDatabaseDocument:(SPDatabaseDocument*)db +{ + dbDocument = db; +} +#endif + #pragma mark - #pragma mark Other methods @@ -1076,9 +1077,6 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { [table release], table = nil; @@ -1097,11 +1095,4 @@ static const NSString *SPNewIndexKeyBlockSize = @"IndexKeyBlockSize"; [super dealloc]; } -#ifdef SP_REFACTOR -- (void)setDatabaseDocument:(SPDatabaseDocument*)db -{ - dbDocument = db; -} -#endif - @end diff --git a/Source/SPPreferenceController.m b/Source/SPPreferenceController.m index f6670a03..58f05e78 100644 --- a/Source/SPPreferenceController.m +++ b/Source/SPPreferenceController.m @@ -54,9 +54,6 @@ @synthesize networkPreferencePane; @synthesize fontChangeTarget; -/** - * init. - */ - (id)init { if ((self = [super initWithWindowNibName:@"Preferences"])) { @@ -266,9 +263,6 @@ #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { [preferencePanes release], preferencePanes = nil; diff --git a/Source/SPPreferencesUpgrade.h b/Source/SPPreferencesUpgrade.h index e3de5cb7..6b7bb0cd 100644 --- a/Source/SPPreferencesUpgrade.h +++ b/Source/SPPreferencesUpgrade.h @@ -42,6 +42,7 @@ void SPApplyRevisionChanges(void); void SPMigrateConnectionFavoritesData(void); void SPMigratePreferencesFromPreviousIdentifer(void); + + (void)showPostMigrationReleaseNotes:(NSArray *)releaseNotes; @end diff --git a/Source/SPProcessListController.m b/Source/SPProcessListController.m index ec795116..7540ed43 100644 --- a/Source/SPProcessListController.m +++ b/Source/SPProcessListController.m @@ -66,9 +66,6 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; #pragma mark - #pragma mark Initialisation -/** - * Initialisation - */ - (id)init { if ((self = [super initWithWindowNibName:@"DatabaseProcessList"])) { @@ -88,9 +85,6 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; return self; } -/** - * Interface initialisation - */ - (void)awakeFromNib { [[self window] setTitle:[NSString stringWithFormat:NSLocalizedString(@"Server Processes on %@", @"server processes window title (var = hostname)"),[[(SPAppController*)[NSApp delegate] frontDocument] name]]]; @@ -133,7 +127,7 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; } #pragma mark - -#pragma mark IBAction methods +#pragma mark IB action methods /** * Copies the currently selected process(es) to the pasteboard. @@ -583,24 +577,6 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; } #pragma mark - - -/** - * Dealloc - */ -- (void)dealloc -{ - [prefs removeObserver:self forKeyPath:SPUseMonospacedFonts]; - - processListThreadRunning = NO; - - [processes release], processes = nil; - - if (autoRefreshTimer) [autoRefreshTimer release], autoRefreshTimer = nil; - - [super dealloc]; -} - -#pragma mark - #pragma mark Private API /** @@ -848,4 +824,19 @@ static NSString *SPTableViewIDColumnIdentifier = @"Id"; [saveProcessesButton setTitle:NSLocalizedString(@"Save View As...", @"save view as button title")]; } +#pragma mark - + +- (void)dealloc +{ + [prefs removeObserver:self forKeyPath:SPUseMonospacedFonts]; + + processListThreadRunning = NO; + + [processes release], processes = nil; + + if (autoRefreshTimer) [autoRefreshTimer release], autoRefreshTimer = nil; + + [super dealloc]; +} + @end diff --git a/Source/SPQueryController.m b/Source/SPQueryController.m index 08eee732..166d89df 100644 --- a/Source/SPQueryController.m +++ b/Source/SPQueryController.m @@ -426,6 +426,9 @@ static SPQueryController *sharedQueryController = nil; } #endif +#pragma mark - +#pragma mark Privat API + /** * Updates the filtered result set based on any filter string and whether or not * all SELECT nd SHOW statements should be shown within the console. @@ -609,9 +612,6 @@ static SPQueryController *sharedQueryController = nil; #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { #ifndef SP_REFACTOR diff --git a/Source/SPQueryControllerInitializer.m b/Source/SPQueryControllerInitializer.m index c8772646..f3a3f70e 100644 --- a/Source/SPQueryControllerInitializer.m +++ b/Source/SPQueryControllerInitializer.m @@ -47,7 +47,7 @@ static NSString *SPCompletionTokensSnippetsKey = @"function_argument_snippets"; @implementation SPQueryController (SPQueryControllerInitializer) /** - * Set the window's auto save name and initialise display + * Set the window's auto save name and initialise display. */ - (void)awakeFromNib { diff --git a/Source/SPQueryFavoriteManager.m b/Source/SPQueryFavoriteManager.m index 36740ca7..485aa3ff 100644 --- a/Source/SPQueryFavoriteManager.m +++ b/Source/SPQueryFavoriteManager.m @@ -46,7 +46,7 @@ #define SP_Int(x) [NSNumber numberWithInteger:x] -@interface SPQueryFavoriteManager (Private) +@interface SPQueryFavoriteManager () - (void)_initWithNoSelection; @@ -55,7 +55,7 @@ @implementation SPQueryFavoriteManager /** - * Initialize the manager with the supplied delegate + * Initialize the manager with the supplied delegate. */ - (id)initWithDelegate:(id)managerDelegate { @@ -79,12 +79,6 @@ return self; } -- (void)dealloc -{ - [favorites release]; - [super dealloc]; -} - /** * Upon awakening bind the query text view's background colour. */ @@ -937,6 +931,9 @@ #endif } +#pragma mark - +#pragma mark Private API + - (void)_initWithNoSelection { [favoritesTableView selectRowIndexes:[NSIndexSet indexSet] byExtendingSelection:NO]; @@ -945,4 +942,13 @@ [favoriteQueryTextView setString:@""]; } +#pragma mark - + +- (void)dealloc +{ + [favorites release]; + + [super dealloc]; +} + @end diff --git a/Source/SPSQLExporter.m b/Source/SPSQLExporter.m index b811c523..c1ce7412 100644 --- a/Source/SPSQLExporter.m +++ b/Source/SPSQLExporter.m @@ -916,9 +916,8 @@ return [placeholderSyntax autorelease]; } -/** - * Dealloc - */ +#pragma mark - + - (void)dealloc { [sqlExportTables release], sqlExportTables = nil; diff --git a/Source/SPServerSupport.m b/Source/SPServerSupport.m index 7900f15f..c2a139eb 100644 --- a/Source/SPServerSupport.m +++ b/Source/SPServerSupport.m @@ -77,7 +77,7 @@ @synthesize serverReleaseVersion; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation /** * Creates and returns an instance of SPServerSupport with the supplied version numbers. The caller is @@ -320,9 +320,6 @@ #pragma mark - #pragma mark Other -/** - * Dealloc. Invalidate all ivars. - */ - (void)dealloc { // Reset version integers diff --git a/Source/SPServerVariablesController.m b/Source/SPServerVariablesController.m index 4a397edd..0d591f2f 100644 --- a/Source/SPServerVariablesController.m +++ b/Source/SPServerVariablesController.m @@ -51,9 +51,6 @@ #pragma mark - #pragma mark Initialisation -/** - * Initialisation - */ - (id)init { if ((self = [super initWithWindowNibName:@"DatabaseServerVariables"])) { @@ -63,9 +60,6 @@ return self; } -/** - * Interface initialisation - */ - (void)awakeFromNib { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; @@ -388,9 +382,6 @@ #pragma mark - -/** - * Dealloc - */ - (void)dealloc { [[NSUserDefaults standardUserDefaults] removeObserver:self forKeyPath:SPUseMonospacedFonts]; diff --git a/Source/SPTableContent.m b/Source/SPTableContent.m index 94e86694..9c03618e 100644 --- a/Source/SPTableContent.m +++ b/Source/SPTableContent.m @@ -102,24 +102,22 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper #pragma mark - -/** - * Standard init method. Initialize various ivars. - */ - (id)init { if ((self = [super init])) { _mainNibLoaded = NO; isWorking = NO; + pthread_mutex_init(&tableValuesLock, NULL); #ifndef SP_REFACTOR nibObjectsToRelease = [[NSMutableArray alloc] init]; #endif - tableValues = [[SPDataStorage alloc] init]; - dataColumns = [[NSMutableArray alloc] init]; - oldRow = [[NSMutableArray alloc] init]; + tableValues = [[SPDataStorage alloc] init]; + dataColumns = [[NSMutableArray alloc] init]; + oldRow = [[NSMutableArray alloc] init]; #ifndef SP_REFACTOR - filterTableData = [[NSMutableDictionary alloc] initWithCapacity:1]; + filterTableData = [[NSMutableDictionary alloc] initWithCapacity:1]; #endif tableRowsCount = 0; @@ -202,9 +200,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper return self; } -/** - * Initialise various interface controls - */ - (void)awakeFromNib { if (_mainNibLoaded) return; @@ -4265,9 +4260,6 @@ static NSString *SPTableFilterSetDefaultOperator = @"SPTableFilterSetDefaultOper #pragma mark - -/** - * dealloc - */ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Source/SPTableData.m b/Source/SPTableData.m index ad3416aa..04aaaed6 100644 --- a/Source/SPTableData.m +++ b/Source/SPTableData.m @@ -51,10 +51,7 @@ @synthesize tableHasAutoIncrementField; -/** - * Init class. - */ -- (id) init +- (id)init { if ((self = [super init])) { columns = [[NSMutableArray alloc] init]; @@ -81,7 +78,7 @@ * * @param theConnection The used connection for the SPDatabaseDocument */ -- (void) setConnection:(SPMySQLConnection *)theConnection +- (void)setConnection:(SPMySQLConnection *)theConnection { mySQLConnection = theConnection; [mySQLConnection retain]; @@ -90,9 +87,8 @@ /** * Retrieve the encoding for the current table, using or refreshing the cache as appropriate. */ -- (NSString *) tableEncoding +- (NSString *)tableEncoding { - // If processing is already in action, wait for it to complete [self _loopWhileWorking]; diff --git a/Source/SPTableInfo.m b/Source/SPTableInfo.m index bda2962e..2c29f3d2 100644 --- a/Source/SPTableInfo.m +++ b/Source/SPTableInfo.m @@ -95,7 +95,7 @@ */ - (void)removeActivity:(NSInteger)pid { - for(id cmd in activities) + for (id cmd in activities) { if ([[cmd objectForKey:@"pid"] integerValue] == pid) { [activities removeObject:cmd]; diff --git a/Source/SPTableRelations.m b/Source/SPTableRelations.m index b08609b8..45450bf1 100644 --- a/Source/SPTableRelations.m +++ b/Source/SPTableRelations.m @@ -62,9 +62,9 @@ static NSString *SPRelationOnDeleteKey = @"on_delete"; @synthesize connection; @synthesize relationData; -/** - * init - */ +#pragma mark - +#pragma mark Initialisation + - (id)init { if ((self = [super init])) { @@ -659,9 +659,6 @@ static NSString *SPRelationOnDeleteKey = @"on_delete"; #pragma mark - -/* - * Dealloc. - */ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Source/SPTableStructure.m b/Source/SPTableStructure.m index 02defd7c..994d4944 100644 --- a/Source/SPTableStructure.m +++ b/Source/SPTableStructure.m @@ -67,11 +67,8 @@ #endif #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation -/** - * Init. - */ - (id)init { if ((self = [super init])) { @@ -96,9 +93,6 @@ return self; } -/** - * Nib awakening. - */ - (void)awakeFromNib { #ifndef SP_REFACTOR /* ui manipulation */ @@ -1439,9 +1433,6 @@ #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Source/SPTableTriggers.m b/Source/SPTableTriggers.m index b0c09a90..10099717 100644 --- a/Source/SPTableTriggers.m +++ b/Source/SPTableTriggers.m @@ -64,11 +64,8 @@ static const NSString *SPTriggerSQLMode = @"TriggerSQLMode"; @synthesize connection; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation -/** - * Init - */ - (id)init { if ((self = [super init])) { @@ -691,9 +688,6 @@ static const NSString *SPTriggerSQLMode = @"TriggerSQLMode"; #pragma mark - -/** - * Dealloc. - */ - (void)dealloc { [triggerData release], triggerData = nil; diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m index 41551114..93ebfe91 100644 --- a/Source/SPTablesList.m +++ b/Source/SPTablesList.m @@ -111,9 +111,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #pragma mark - #pragma mark Initialisation -/** - * Standard init method. Performs various ivar initialisations. - */ - (id)init { if ((self = [super init])) { @@ -136,9 +133,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; return self; } -/** - * Standard awakeFromNib method for interface loading. - */ - (void)awakeFromNib { #ifndef SP_REFACTOR @@ -2046,26 +2040,6 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; #endif #pragma mark - - -/** - * Standard dealloc method. - */ -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - [tables release]; - [tableTypes release]; -#ifndef SP_REFACTOR - if (isTableListFiltered && filteredTables) [filteredTables release]; - if (isTableListFiltered && filteredTableTypes) [filteredTableTypes release]; -#endif - if (selectedTableName) [selectedTableName release]; - - [super dealloc]; -} - -#pragma mark - #pragma mark Private API /** @@ -2613,4 +2587,21 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable"; [NSException raise:@"Object of unknown type" format:NSLocalizedString(@"An error occured while renaming. '%@' is of an unknown type.", @"rename error - don't know what type the renamed thing is"), oldTableName]; } +#pragma mark - + +- (void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [tables release]; + [tableTypes release]; +#ifndef SP_REFACTOR + if (isTableListFiltered && filteredTables) [filteredTables release]; + if (isTableListFiltered && filteredTableTypes) [filteredTableTypes release]; +#endif + if (selectedTableName) [selectedTableName release]; + + [super dealloc]; +} + @end diff --git a/Source/SPUserManager.m b/Source/SPUserManager.m index a320a8c6..8b7a3f33 100644 --- a/Source/SPUserManager.m +++ b/Source/SPUserManager.m @@ -79,11 +79,8 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn"; @synthesize serverSupport; #pragma mark - -#pragma mark Initialization +#pragma mark Initialisation -/** - * Initialization. - */ - (id)init { if ((self = [super initWithWindowNibName:@"UserManagerView"])) { @@ -1392,9 +1389,6 @@ static const NSString *SPTableViewNameColumnID = @"NameColumn"; #pragma mark - -/** - * Dealloc. Get rid of everything. - */ - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; diff --git a/Source/SPUserManagerDelegate.m b/Source/SPUserManagerDelegate.m index fde0e69f..c1a96ba9 100644 --- a/Source/SPUserManagerDelegate.m +++ b/Source/SPUserManagerDelegate.m @@ -40,7 +40,7 @@ static NSString *SPGlobalPrivilegesTabIdentifier = @"Global Privileges"; static NSString *SPResourcesTabIdentifier = @"Resources"; static NSString *SPSchemaPrivilegesTabIdentifier = @"Schema Privileges"; -@interface SPUserManager (SPDeclaredAPI) +@interface SPUserManager (DeclaredAPI) - (void)_initializeSchemaPrivs; - (void)_initializeAvailablePrivs; @@ -52,7 +52,6 @@ static NSString *SPSchemaPrivilegesTabIdentifier = @"Schema Privileges"; @end - @implementation SPUserManager (SPUserManagerDelegate) #pragma mark - diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index f7bd0aba..bef7cbc1 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -62,9 +62,6 @@ enum { #pragma mark - #pragma mark Initialisation -/** - * awakeFromNib - */ - (void)awakeFromNib { systemVersion = 0; diff --git a/Source/SPXMLExporter.m b/Source/SPXMLExporter.m index 272ccaff..7f976449 100644 --- a/Source/SPXMLExporter.m +++ b/Source/SPXMLExporter.m @@ -356,9 +356,8 @@ [pool release]; } -/** - * Dealloc - */ +#pragma mark - + - (void)dealloc { if (xmlDataArray) [xmlDataArray release], xmlDataArray = nil; |