From 676a46d50bc4f2915de2d88c33edfc56963f53b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sat, 8 May 2010 21:42:30 +0000 Subject: [PATCH] fSelected was accessed unchecked in _UpdateStateOpenSelect(), but the method can be called without any item being selected yet. In that case, fall back to just select the item and return (setting fSelected). I've had Tracker crash with a BT that suggest this was the case, when I invoked some context menu. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36759 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index 3d8b0006c1..e9c24efb7b 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1549,6 +1549,9 @@ BMenu::_Hide() } +// #pragma mark - mouse tracking + + const static bigtime_t kOpenSubmenuDelay = 225000; const static bigtime_t kNavigationAreaTimeout = 1000000; const static bigtime_t kHysteresis = 200000; @@ -1800,7 +1803,8 @@ BMenu::_UpdateStateOpenSelect(BMenuItem* item, BPoint position, bool inNavAreaRectAbove = navAreaRectAbove.Contains(position); bool inNavAreaRectBelow = navAreaRectBelow.Contains(position); - if (!inNavAreaRectAbove && !inNavAreaRectBelow) { + if (fSelected == NULL + || (!inNavAreaRectAbove && !inNavAreaRectBelow)) { _SelectItem(item, false); navAreaRectAbove = BRect(); navAreaRectBelow = BRect(); @@ -1911,6 +1915,9 @@ BMenu::_UpdateStateClose(BMenuItem* item, const BPoint& where, } +// #pragma mark - + + bool BMenu::_AddItem(BMenuItem* item, int32 index) {