Use BMenu::RemoveItems() instead of looping... I hope I caught all
occurrences. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19910 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -144,16 +144,11 @@ TBarWindow::MenusEnded()
|
|||||||
{
|
{
|
||||||
BWindow::MenusEnded();
|
BWindow::MenusEnded();
|
||||||
|
|
||||||
if (!sBeMenu->LockLooper()) {
|
if (sBeMenu->LockLooper()) {
|
||||||
// TODO: is this ok?
|
// TODO: is this ok?
|
||||||
return;
|
sBeMenu->RemoveItems(0, sBeMenu->CountItems(), true);
|
||||||
|
sBeMenu->UnlockLooper();
|
||||||
}
|
}
|
||||||
|
|
||||||
BMenuItem *item = NULL;
|
|
||||||
while ((item = sBeMenu->RemoveItem((int32)0)) != NULL)
|
|
||||||
delete item;
|
|
||||||
|
|
||||||
sBeMenu->UnlockLooper();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -138,14 +138,7 @@ TBeMenu::DetachedFromWindow()
|
|||||||
bool
|
bool
|
||||||
TBeMenu::StartBuildingItemList()
|
TBeMenu::StartBuildingItemList()
|
||||||
{
|
{
|
||||||
int32 count = CountItems()-1;
|
RemoveItems(0, CountItems(), true);
|
||||||
for (int32 index = count; index >= 0; index--) {
|
|
||||||
BMenuItem *item = ItemAt(index);
|
|
||||||
ASSERT(item);
|
|
||||||
|
|
||||||
RemoveItem(index);
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
fAddState = kStart;
|
fAddState = kStart;
|
||||||
return BNavMenu::StartBuildingItemList();
|
return BNavMenu::StartBuildingItemList();
|
||||||
}
|
}
|
||||||
@@ -555,14 +548,7 @@ TRecentsMenu::DetachedFromWindow()
|
|||||||
bool
|
bool
|
||||||
TRecentsMenu::StartBuildingItemList()
|
TRecentsMenu::StartBuildingItemList()
|
||||||
{
|
{
|
||||||
int32 count = CountItems()-1;
|
RemoveItems(0, CountItems(), true);
|
||||||
for (int32 index = count; index >= 0; index--) {
|
|
||||||
BMenuItem *item = ItemAt(index);
|
|
||||||
ASSERT(item);
|
|
||||||
|
|
||||||
RemoveItem(index);
|
|
||||||
delete item;
|
|
||||||
}
|
|
||||||
|
|
||||||
// !! note: don't call inherited from here
|
// !! note: don't call inherited from here
|
||||||
// the navref is not set for this menu
|
// the navref is not set for this menu
|
||||||
@@ -732,9 +718,7 @@ MountMenu::MountMenu(const char *name)
|
|||||||
bool
|
bool
|
||||||
MountMenu::AddDynamicItem(add_state s)
|
MountMenu::AddDynamicItem(add_state s)
|
||||||
{
|
{
|
||||||
BMenuItem *item;
|
RemoveItems(0, CountItems(), true);
|
||||||
while ((item = RemoveItem(0L)) != NULL)
|
|
||||||
delete item;
|
|
||||||
|
|
||||||
// Send message to tracker to get items.
|
// Send message to tracker to get items.
|
||||||
BMessage request('gmtv');
|
BMessage request('gmtv');
|
||||||
|
|||||||
@@ -191,9 +191,7 @@ TExpandoMenuBar::DetachedFromWindow()
|
|||||||
message.AddMessenger("messenger", self);
|
message.AddMessenger("messenger", self);
|
||||||
be_app->PostMessage(&message);
|
be_app->PostMessage(&message);
|
||||||
|
|
||||||
BMenuItem *item = NULL;
|
RemoveItems(0, CountItems(), true);
|
||||||
while ((item = RemoveItem(0L)) != NULL)
|
|
||||||
delete item;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,7 @@ TTeamMenu::CompareByName(const void *first, const void *second)
|
|||||||
void
|
void
|
||||||
TTeamMenu::AttachedToWindow()
|
TTeamMenu::AttachedToWindow()
|
||||||
{
|
{
|
||||||
BMenuItem *item = NULL;
|
RemoveItems(0, CountItems(), true);
|
||||||
while ((item = RemoveItem((int32)0)) != NULL)
|
|
||||||
delete item;
|
|
||||||
|
|
||||||
BMessenger self(this);
|
BMessenger self(this);
|
||||||
BList teamList;
|
BList teamList;
|
||||||
|
|||||||
Reference in New Issue
Block a user