From 289a0c98b50b6da590b50a14969dfd986bab18c3 Mon Sep 17 00:00:00 2001 From: Bibiko Date: Tue, 29 Jun 2010 12:44:33 +0000 Subject: =?UTF-8?q?=E2=80=A2=C2=A0made=20SP=20more=20robust=20against=20fa?= =?UTF-8?q?st=20closing=20of=20tabs=20and=20windows=20=E2=80=A2=20setHideF?= =?UTF-8?q?orSingleTab:YES=20after=20opening=20spfs=20session?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Frameworks/PSMTabBar/PSMTabBarControl.m | 4 ++-- Source/SPAppController.m | 1 + Source/SPHistoryController.m | 4 +++- Source/SPWindowController.m | 4 ++-- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Frameworks/PSMTabBar/PSMTabBarControl.m b/Frameworks/PSMTabBar/PSMTabBarControl.m index 1023444d..d361364e 100644 --- a/Frameworks/PSMTabBar/PSMTabBarControl.m +++ b/Frameworks/PSMTabBar/PSMTabBarControl.m @@ -942,14 +942,14 @@ //send the delegate messages if (_isHidden) { - if ([[self delegate] respondsToSelector:@selector(tabView:tabBarDidHide:)]) { + if ([self delegate] && [[self delegate] respondsToSelector:@selector(tabView:tabBarDidHide:)]) { [[self delegate] tabView:[self tabView] tabBarDidHide:self]; } } else { [self addSubview:_overflowPopUpButton]; [self addSubview:_addTabButton]; - if ([[self delegate] respondsToSelector:@selector(tabView:tabBarDidUnhide:)]) { + if ([self delegate] && [[self delegate] respondsToSelector:@selector(tabView:tabBarDidUnhide:)]) { [[self delegate] tabView:[self tabView] tabBarDidUnhide:self]; } } diff --git a/Source/SPAppController.m b/Source/SPAppController.m index 85ad93a2..8635fb29 100644 --- a/Source/SPAppController.m +++ b/Source/SPAppController.m @@ -395,6 +395,7 @@ } [newWindowController selectTabAtIndex:[[window objectForKey:@"selectedTabIndex"] intValue]]; + [newWindowController setHideForSingleTab:YES]; } diff --git a/Source/SPHistoryController.m b/Source/SPHistoryController.m index 9e7f20da..8478c6b4 100644 --- a/Source/SPHistoryController.m +++ b/Source/SPHistoryController.m @@ -93,6 +93,8 @@ if ([history count] && historyPosition > 0) backEnabled = YES; if ([history count] && historyPosition + 1 < [history count]) forwardEnabled = YES; + if(!historyControl) return; + [historyControl setEnabled:backEnabled forSegment:0]; [historyControl setEnabled:forwardEnabled forSegment:1]; @@ -229,7 +231,7 @@ - (void) toolbarWillAddItem:(NSNotification *)aNotification { if ([[[[aNotification userInfo] objectForKey:@"item"] itemIdentifier] isEqualToString:SPMainToolbarHistoryNavigation]) { toolbarItemVisible = YES; - [self performSelector:@selector(updateToolbarItem) withObject:nil afterDelay:0.1]; + [self performSelectorOnMainThread:@selector(updateToolbarItem) withObject:nil waitUntilDone:YES]; } } diff --git a/Source/SPWindowController.m b/Source/SPWindowController.m index 5f8e34cd..0cfe9e8e 100644 --- a/Source/SPWindowController.m +++ b/Source/SPWindowController.m @@ -654,8 +654,8 @@ * or the selected table document supports the selector. */ - (BOOL) respondsToSelector:(SEL)theSelector -{ - return ([super respondsToSelector:theSelector] || [selectedTableDocument respondsToSelector:theSelector]); +{ + return ([super respondsToSelector:theSelector] || (selectedTableDocument && [selectedTableDocument respondsToSelector:theSelector])); } /** -- cgit v1.2.3