Description
I have been seeing crashes in `[QCocoaMenuDelegate validateMenuItem:]` when apparently this method was invoked by the Cocoa runtime with a menuitem belonging to an invalid QCocoaMenuItem instance. Specifically, `menuItem.tag` returned a pointer to an invalid QCocoaMenuItem instance. This happens in the current git/master of KF5's Konsole application when patched to use the native menubar on Mac (a 1 line change, removing the AA_DontUseNativeMenuBar attribute).
Looking at the QCocoaMenuItem housekeeping I noticed that the NSMenuItem tag is never unset (in qcocoamenuitem.mm at least). As an experiment I added `[m_native setTag:0]` calls to the QCocoaMenuItem dtor and before most `[m_native release]` calls. I'm not yet certain whether that latter change has any impact (except obliging to check the return value of `[NSMenuItem tag]` in qcocoamenu.mm).
But shouldn't the QCocoaMenuItem dtor set this tag to 0, given that the `m_native` instance is almost guaranteed to live longer than the QCocoaMenuItem instance? This change does seem to solve my crashing issue.