Avoid tracking the menubar if it's tracking already

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16974 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stefano Ceccherini 2006-04-02 21:47:46 +00:00
parent 290026d3b1
commit a2b0a7ac3e

View File

@ -298,6 +298,9 @@ BMenuBar::operator=(const BMenuBar &)
void void
BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *specialRect) BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *specialRect)
{ {
if (fTracking)
return;
BWindow *window = Window(); BWindow *window = Window();
if (window == NULL) if (window == NULL)
debugger("MenuBar must be added to a window before it can be used."); debugger("MenuBar must be added to a window before it can be used.");
@ -305,7 +308,7 @@ BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *speci
BAutolock lock(window); BAutolock lock(window);
if (!lock.IsLocked()) if (!lock.IsLocked())
return; return;
fPrevFocusToken = -1; fPrevFocusToken = -1;
fTracking = true; fTracking = true;
@ -329,6 +332,7 @@ BMenuBar::StartMenuBar(int32 menuIndex, bool sticky, bool showMenu, BRect *speci
send_data(fTrackingPID, 0, &data, sizeof(data)); send_data(fTrackingPID, 0, &data, sizeof(data));
} else { } else {
fTracking = false;
_set_menu_sem_(window, B_NO_MORE_SEMS); _set_menu_sem_(window, B_NO_MORE_SEMS);
delete_sem(fMenuSem); delete_sem(fMenuSem);
} }