From 994057ae2a82dc110a385ced4239ce49cc0601f8 Mon Sep 17 00:00:00 2001 From: Max Date: Sat, 13 Dec 2014 17:20:18 +0100 Subject: Add cast for [NSApp delegate] * (Also changed some outdated URLs) * Replaced [NSApplication sharedApplication] with NSApp --- Source/SPDatabaseViewController.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/SPDatabaseViewController.m') diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index c1823661..9b0ded39 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -589,7 +589,7 @@ [self endTask]; #ifndef SP_CODA /* triggered commands */ - NSArray *triggeredCommands = [[NSApp delegate] bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; + NSArray *triggeredCommands = [SPAppDelegate bundleCommandsForTrigger:SPBundleTriggerActionTableChanged]; for(NSString* cmdPath in triggeredCommands) { @@ -615,7 +615,7 @@ } if(!stopTrigger) { if([[data objectAtIndex:1] isEqualToString:SPBundleScopeGeneral]) { - [[[NSApp delegate] onMainThread] executeBundleItemForApp:aMenuItem]; + [[SPAppDelegate onMainThread] executeBundleItemForApp:aMenuItem]; } else if([[data objectAtIndex:1] isEqualToString:SPBundleScopeDataTable]) { if([[[[[NSApp mainWindow] firstResponder] class] description] isEqualToString:@"SPCopyTable"]) -- cgit v1.2.3 From 2735e15bf5d4b3a976435ebb29ca9073de0e5071 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 4 Jan 2015 03:57:26 +0100 Subject: Formalize [x release], x = nil; convention Take this commit as a proposal to formalize our existing "[x release], x = nil;" convention by introducing a macro for it. Feel free to revert this commit if you see issues with the approch or implementation. --- Source/SPDatabaseViewController.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/SPDatabaseViewController.m') diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index 9b0ded39..c43761d3 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -332,7 +332,7 @@ if (!aTable) { // Update the selected table name and type - if (selectedTableName) [selectedTableName release], selectedTableName = nil; + if (selectedTableName) SPClear(selectedTableName); selectedTableType = SPTableTypeNone; -- cgit v1.2.3 From f03de6f42b1ea00875f9d57accbee2537604ee39 Mon Sep 17 00:00:00 2001 From: Max Date: Sun, 5 Apr 2015 20:01:17 +0200 Subject: Fix a threading issue when adding tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (Also the localizations should now work again on 10.10 🎉) --- Source/SPDatabaseViewController.m | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Source/SPDatabaseViewController.m') diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index c43761d3..ea2186cc 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -116,16 +116,17 @@ #pragma mark - #pragma mark Tab view control and delegate methods +//WARNING: Might be called from code in background threads - (IBAction)viewStructure:(id)sender { // Cancel the selection if currently editing a view and unable to save if (![self couldCommitCurrentViewActions]) { - [mainToolbar setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; + [[mainToolbar onMainThread] setSelectedItemIdentifier:*SPViewModeToMainToolbarMap[[prefs integerForKey:SPLastViewMode]]]; return; } - [tableTabView selectTabViewItemAtIndex:0]; - [mainToolbar setSelectedItemIdentifier:SPMainToolbarTableStructure]; + [[tableTabView onMainThread] selectTabViewItemAtIndex:0]; + [[mainToolbar onMainThread] setSelectedItemIdentifier:SPMainToolbarTableStructure]; [spHistoryControllerInstance updateHistoryEntries]; [prefs setInteger:SPStructureViewMode forKey:SPLastViewMode]; -- cgit v1.2.3