Subject: bug#7190: Crash in menus on w32

From: grischka <[email-masked]>
Date: Thu, 21 Oct 2010 19:07:42 +0200

Jason Rumney wrote:
> I don't see anything in your change to handle freeing of the menubar
> structures in the case where the user clicks on the menubar then clicks
> away without selecting anything.  

This is correct.  The patch frees the item-string always when (and
in the same place where) the MENUITEM structure itself is destroyed.
Since this structure is the only place that has the pointer, it is
hence impossible by design to access the pointer after it was freed.

> The above code was to fix a memory and resource leak in that case.

With the patch, leaking these strings cannot happen by design also
provided the MENUITEMs themselves are destroyed correctly always which
is made sure by bugs 2/3 fixed:
>> 2) memory leak: was trying to free items from already deleted menu
>> 3) memory leak: was trying to free menu from already deleted window

--- grischka