diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index f69a725a33..40c951465e 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -959,14 +959,9 @@ BMenu::Hide() BMenuItem * -BMenu::Track(bool openAnyway, BRect *clickToOpenRect) -{ - if (!IsStickyPrefOn()) - openAnyway = false; - - SetStickyMode(openAnyway); - - if (openAnyway && LockLooper()) { +BMenu::Track(bool sticky, BRect *clickToOpenRect) +{ + if (sticky && LockLooper()) { RedrawAfterSticky(Bounds()); UnlockLooper(); } @@ -977,8 +972,12 @@ BMenu::Track(bool openAnyway, BRect *clickToOpenRect) UnlockLooper(); } + // If sticky is false, pass 0 to the tracking function + // so the menu will stay in nonsticky mode, regardless + // of the "IsStickyPrefOn()" value + const bigtime_t trackTime = sticky ? system_time() : 0; int action; - BMenuItem *menuItem = _track(&action, system_time()); + BMenuItem *menuItem = _track(&action, trackTime); SetStickyMode(false); fExtraRect = NULL; diff --git a/src/kits/interface/PopUpMenu.cpp b/src/kits/interface/PopUpMenu.cpp index a46a8c7d7c..504b8b76a4 100644 --- a/src/kits/interface/PopUpMenu.cpp +++ b/src/kits/interface/PopUpMenu.cpp @@ -267,6 +267,14 @@ BMenuItem * BPopUpMenu::_go(BPoint where, bool autoInvoke, bool startOpened, BRect *_specialRect, bool async) { + if (fTrackThread >= 0) { + // Something bad happened: Go() was called on us twice, and we got here + // while the other instance hasn't finished yet. + // TODO: Maybe we should simply call debugger() ? + status_t unused; + wait_for_thread(fTrackThread, &unused); + } + BMenuItem *selected = NULL; // Can't use Window(), as the BPopUpMenu isn't attached