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

Crash in QAction / QMenuBar on OS X

    XMLWordPrintable

Details

    • macOS

    Description

      My application closes when I close the QMainWindow on OS X.

      The problems to be located in the menu items which are moved into the application menu. When the window is closed I open a message box asking if somebody wants to save the current document. It seems that during this time several events run up in QApplication's queue. After agreeing to he message box and closing the window the QActions are also destroyed - but the NSMenuItem objects's tags are not updated and the QAction is still stored as zombie pointer.
      After QApplication enters the main loop it dispatches the queued events, changing the modal state of the menu. This accesses the zombie pointer and leads to the crash.

      It is not always reproducible without problems since if timing is good the free memory still contain valid data and the application does not crash.

      StackTrace:

      0  QtGui                            0x0068d907 QAction::isEnabled() const + 9
      1  QtGui                            0x00674c7d qt_mac_set_modal_state_helper_recursive(NSMenu*, NSMenu*, bool) + 365
      2  QtGui                            0x00674c43 qt_mac_set_modal_state_helper_recursive(NSMenu*, NSMenu*, bool) + 307
      3  QtGui                            0x00679b96 QMenuBarPrivate::macUpdateMenuBarImmediatly() + 2464
      4  com.apple.CoreFoundation          0x9564f28a -[NSObject performSelector:] + 58
      5  QtGui                            0x00642df3 -[NSApplication(QApplicationIntegration) qt_sendPostedMessage:] + 323
      6  QtGui                            0x00642bec -[NSApplication(QApplicationIntegration) qt_filterEvent:] + 140
      7  QtGui                            0x00642e7f -[QNSApplication sendEvent:] + 47
      8  com.apple.AppKit                  0x9b0c66d5 -[NSApplication run] + 1007
      9  QtGui                            0x0064ca0a QEventDispatcherMac::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 956
      10  QtCore                            0x013ad790 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 494
      11  QtCore                            0x013b09a1 QCoreApplication::exec() + 179
      

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            andreasloew Andreas Loew
            Votes:
            3 Vote for this issue
            Watchers:
            13 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes