Closed Bug 459040 Opened 18 years ago Closed 18 years ago

Console error when removing all items from an empty systray menu

Categories

(Mozilla Labs :: Prism, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: matthew.gertner, Assigned: matthew.gertner)

Details

Attachments

(1 file)

On Windows, there is a crash when you try to remove all menu items from the systray icon if no items have ever been added to it. The correct behavior would be simply to do nothing.
Attachment #342240 - Flags: review?(mark.finkle)
Comment on attachment 342240 [details] [diff] [review] Check whether the menu exists and do nothing if it doesn't >Index: runtime/components/src/windows/nsNotificationArea.cpp >=================================================================== >--- runtime/components/src/windows/nsNotificationArea.cpp (revision 17794) >+++ runtime/components/src/windows/nsNotificationArea.cpp (working copy) >@@ -320,13 +320,13 @@ > NS_IMETHODIMP > nsNotificationArea::RemoveAllMenuItems() > { >- NS_ENSURE_STATE(mMenu); >- >- int menuCount = ::GetMenuItemCount(mMenu); >- >- PRUint32 i; >- for (i=menuCount; i>0; i--) { >- ::RemoveMenu(mMenu, i-1, MF_BYPOSITION); >+ if (mMenu) { >+ int menuCount = ::GetMenuItemCount(mMenu); >+ >+ PRUint32 i; >+ for (i=menuCount; i>0; i--) { >+ ::RemoveMenu(mMenu, i-1, MF_BYPOSITION); >+ } > } > > return NS_OK; You could use: if (!mMenu) return; at the top as well. keeps the indenting to a minimum
Attachment #342240 - Flags: review?(mark.finkle) → review+
Sorry, it doesn't crash, it just spits out an error message in the console. Anyway, fixed now. Sending runtime/components/src/windows/nsNotificationArea.cpp Transmitting file data . Committed revision 18927.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
Summary: Crash when removing all items from an empty systray menu → Console error when removing all items from an empty systray menu
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: