From e0fcf72ae00e04f7746f76cf8e675b40a679506b Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Tue, 21 Nov 2006 14:54:44 +0000 Subject: [PATCH] Fixed some semi-random crashes in deskbar and tracker caused by the new scrolling code. patch by Lucasz Zemczak. Also now the menu tracking function checks the result of the userdefined tracking hook, thus fixing bug #938 git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19348 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/kits/interface/Menu.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/kits/interface/Menu.cpp b/src/kits/interface/Menu.cpp index e18fbef7ba..72ad836e0e 100644 --- a/src/kits/interface/Menu.cpp +++ b/src/kits/interface/Menu.cpp @@ -1184,8 +1184,7 @@ BMenu::_show(bool selectFirstItem) if (window->Lock()) { fAttachAborted = false; window->AttachMenu(this); - fCachedMenuWindow = window; - + // Menu didn't have the time to add its items: aborting... if (fAttachAborted) { window->DetachMenu(); @@ -1204,7 +1203,6 @@ BMenu::_show(bool selectFirstItem) MoveTo(1, 1); UpdateWindowViewSize(); - fCachedMenuWindow = NULL; window->Show(); if (selectFirstItem) @@ -1259,8 +1257,9 @@ BMenu::_track(int *action, bigtime_t trackTime, long start) while (true) { if (fExtraMenuData != NULL && fExtraMenuData->trackingHook != NULL && fExtraMenuData->trackingState != NULL) { - /*bool result =*/ fExtraMenuData->trackingHook(this, fExtraMenuData->trackingState); - //printf("tracking hook returned %s\n", result ? "true" : "false"); + bool quit = fExtraMenuData->trackingHook(this, fExtraMenuData->trackingState); + if (quit) + break; } bool locked = LockLooper(); @@ -2073,8 +2072,7 @@ BMenu::UpdateWindowViewSize(bool upWind) // attach scrollers to our cached MenuWindow. window->ResizeTo(Bounds().Width() + 2, screen.Frame().bottom - 10); - if (fCachedMenuWindow) - fCachedMenuWindow->AttachScrollers(); + static_cast(window)->AttachScrollers(); frame.top = 0; }