crash fix in Cocoa menus. we build this code in Camino but we don't use it. sr=pinkerton

This commit is contained in:
joshmoz%gmail.com 2005-10-26 23:25:19 +00:00
parent 11014437a0
commit 16ad0bb77c

View File

@ -386,6 +386,7 @@ NS_IMETHODIMP nsMenuX::RemoveItem(const PRUint32 aPos)
NS_IMETHODIMP nsMenuX::RemoveAll()
{
//XXXJOSH why don't we set |mNumMenuItems| to 0 after removing all menu items?
if (mMacMenu != NULL) {
/*
// clear command id's
@ -399,9 +400,7 @@ NS_IMETHODIMP nsMenuX::RemoveAll()
}
}
*/
//XXXJOSH we crash here sometimes, log message shows
// nsMenuX::RemoveAll: Total menu count is 16, attempting to access 31
for (int i = mNumMenuItems - 1; i >= 0; i--) {
for (int i = [mMacMenu numberOfItems] - 1; i >= 0; i--) {
[mMacMenu removeItemAtIndex:i];
}
}