Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-70402

crash in [QCocoaMenuDelegate validateMenuItem:]

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12
    • 5.9.6
    • QPA
    • None
    • macOS

    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.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            rjvbertin René Bertin
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes