Use BMenu::RemoveItems() instead of iterating.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37488 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -152,9 +152,7 @@ BSlowContextMenu::NeedsToRebuild() const
|
|||||||
void
|
void
|
||||||
BSlowContextMenu::ClearMenu()
|
BSlowContextMenu::ClearMenu()
|
||||||
{
|
{
|
||||||
int32 count = CountItems();
|
RemoveItems(0, CountItems(), true);
|
||||||
for (int32 index = count - 1; index >= 0; index--)
|
|
||||||
delete RemoveItem(index);
|
|
||||||
|
|
||||||
fMenuBuilt = false;
|
fMenuBuilt = false;
|
||||||
}
|
}
|
||||||
@@ -169,9 +167,7 @@ BSlowContextMenu::ClearMenuBuildingState()
|
|||||||
// item list is non-owning, need to delete the items because
|
// item list is non-owning, need to delete the items because
|
||||||
// they didn't get added to the menu
|
// they didn't get added to the menu
|
||||||
if (fItemList) {
|
if (fItemList) {
|
||||||
int32 count = fItemList->CountItems();
|
RemoveItems(0, fItemList->CountItems(), true);
|
||||||
for (int32 index = count - 1; index >= 0; index--)
|
|
||||||
delete RemoveItem(index);
|
|
||||||
delete fItemList;
|
delete fItemList;
|
||||||
fItemList = NULL;
|
fItemList = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user