From 6e194a72e7b9bfec0b0d1de850df4509c3b92c6e Mon Sep 17 00:00:00 2001 From: Stefano Ceccherini Date: Fri, 22 Dec 2006 07:34:05 +0000 Subject: [PATCH] only lock after checking the other conditions. Also changed iteration to remove menu items with a single RemoveItems() call. Axel, I hope you don't mind. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19600 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/deskbar/WindowMenu.cpp | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/apps/deskbar/WindowMenu.cpp b/src/apps/deskbar/WindowMenu.cpp index 006c3cd7a6..29a2ff05f5 100644 --- a/src/apps/deskbar/WindowMenu.cpp +++ b/src/apps/deskbar/WindowMenu.cpp @@ -81,9 +81,7 @@ TWindowMenu::AttachedToWindow() { SetFont(be_plain_font); - BMenuItem *item = NULL; - while ((item = RemoveItem((int32)0)) != NULL) - delete (item); + RemoveItems(0, CountItems(), true); int32 miniCount = 0; @@ -212,12 +210,10 @@ TWindowMenu::DetachedFromWindow() // in expando mode the teammenu will not call DragStop, // thus, it needs to be called from here TBarView *barview = (dynamic_cast(be_app))->BarView(); - if (barview && barview->LockLooper()) { - if (barview->Expando() && barview->Dragging()) { - // We changed the show level in AttachedToWindow(). Undo it. - Window()->Show(); - barview->DragStop(); - } + if (barview && barview->Expando() && barview->Dragging() && barview->LockLooper()) { + // We changed the show level in AttachedToWindow(). Undo it. + Window()->Show(); + barview->DragStop(); barview->UnlockLooper(); }