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.

This commit is contained in:
smfr%smfr.org 2005-08-27 03:38:49 +00:00
Родитель a1a4cb4d78
Коммит 70719bc37e
1 изменённых файлов: 19 добавлений и 0 удалений

Просмотреть файл

@ -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