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

Random crash in (BOOL)validateMenuItem:(NSMenuItem*)menuItem

    XMLWordPrintable

Details

    • macOS
    • b854772676ff2b0e610b522279c997618496c050

    Description

      Sometimes the application crashes in qcocoamenu.mm

      - (BOOL)validateMenuItem:(NSMenuItem*)menuItem

       

      I debugged it by adding a bunch of logging to the validateMenuItem, the places where the NSMenuItem is released and to the constructor and destructor of QCocoaMenuItem and noticed that when it crashes the QCocoaMenuItem it tries to use in validateMenuItem is already destroyed.

      The NSMenuItem can be released in multiple different places and none of them update the tag of it. Calling release for the item doesn't necessarily cause it to be deallocated since it only reduces the reference count of it and thus the tag will still point to the QCocoaMenuItem and when that QCocoaMenuItem gets destroyed the NSMenuItem will point to already released memory.

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            kkarvinen Kimmo Karvinen
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes