Fix bug 306084: avoid crashes when closing the last tab (or trying to move it to a new window), and disable the menu items as appropriate.

git-svn-id: svn://10.0.0.236/trunk@179123 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
smfr%smfr.org
2005-08-27 03:43:23 +00:00
parent cae2234143
commit ffde60f96b

View File

@@ -1233,6 +1233,22 @@ enum BWCOpenDest {
#pragma mark -
-(BOOL)validateMenuItem: (NSMenuItem*)aMenuItem
{
SEL action = [aMenuItem action];
if (action == @selector(moveTabToNewWindow:) ||
action == @selector(closeCurrentTab:) ||
action == @selector(closeSendersTab:) ||
action == @selector(closeOtherTabs:))
return ([mTabBrowser numberOfTabViewItems] > 1);
return YES;
}
#pragma mark -
// BrowserUIDelegate methods (called from the frontmost tab's BrowserWrapper)
@@ -2570,6 +2586,9 @@ enum BWCOpenDest {
{
[[NSApp delegate] fixCloseMenuItemKeyEquivalents];
[mTabBrowser refreshTabBar:YES];
// paranoia, to avoid stale mBrowserView pointer (since we don't own it)
if ([aTabView numberOfTabViewItems] == 0)
mBrowserView = nil;
}
-(BrowserTabView*)getTabBrowser