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

macOS exception when adding QAction to QMenu

    XMLWordPrintable

Details

    • macOS
    • b2f78b796b5b73d4f0732975ffd66f8aa392c001, 093e1111ef68a8a83e42d5d82fc9d5c93d47071b, 2a44f81fe7bb76cf7ced5bae5a2654b96f0e93c6

    Description

      compile and run the attached sample:
      It crashes with the following trace

      ./qt5menubar.app/Contents/MacOS/qt5menubar 
      menu item "E&xit" has unsupported role 0
      menu item "&Copy" has unsupported role 0
      menu item "C&ut" has unsupported role 0
      menu item "&Paste" has unsupported role 0
      2016-11-30 23:08:07.597 qt5menubar[39068:2823790] *** Assertion failure in -[NSMenu insertItem:atIndex:], /Library/Caches/com.apple.xbs/Sources/AppKit/AppKit-1404.47/Menus.subproj/NSMenu.m:713
      2016-11-30 23:08:07.599 qt5menubar[39068:2823790] An uncaught exception was raised
      2016-11-30 23:08:07.600 qt5menubar[39068:2823790] Item to be inserted into menu already is in another menu
      2016-11-30 23:08:07.600 qt5menubar[39068:2823790] (
      	0   CoreFoundation                      0x00007fff9766c452 __exceptionPreprocess + 178
      	1   libobjc.A.dylib                     0x00007fff8f42073c objc_exception_throw + 48
      	2   CoreFoundation                      0x00007fff9767112a +[NSException raise:format:arguments:] + 106
      	3   Foundation                          0x00007fff8c414856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
      	4   AppKit                              0x00007fff84986803 -[NSMenu insertItem:atIndex:] + 318
      	5   libqcocoa.dylib                     0x000000010af3aa04 _ZN10QCocoaMenu12insertNativeEP14QCocoaMenuItemS1_ + 452
      	6   libqcocoa.dylib                     0x000000010af3af94 _ZN10QCocoaMenu12syncMenuItemEP17QPlatformMenuItem + 500
      	7   libqcocoa.dylib                     0x000000010af3f144 _ZN13QCocoaMenuBar8syncMenuEP13QPlatformMenu + 372
      	8   libqcocoa.dylib                     0x000000010af3e446 _ZN13QCocoaMenuBar24updateMenuBarImmediatelyEv + 630
      	9   libqcocoa.dylib                     0x000000010af3ed1f _ZN13QCocoaMenuBar10insertMenuEP13QPlatformMenuS1_ + 1055
      	10  QtWidgets                           0x0000000107063954 _ZN8QMenuBar11actionEventEP12QActionEvent + 1140
      	11  QtWidgets                           0x0000000106f16db0 _ZN7QWidget5eventEP6QEvent + 384
      	12  QtWidgets                           0x0000000107063e92 _ZN8QMenuBar5eventEP6QEvent + 482
      	13  QtWidgets                           0x0000000106ed5746 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 294
      	14  QtWidgets                           0x0000000106ed6ca8 _ZN12QApplication6notifyEP7QObjectP6QEvent + 504
      	15  QtCore                              0x0000000107df1f24 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 164
      	16  QtWidgets                           0x0000000106f0ae2f _ZN7QWidget12insertActionEP7QActionS1_ + 431
      	17  QtWidgets                           0x0000000107062030 _ZN8QMenuBar7addMenuEP5QMenu + 32
      	18  qt5menubar                          0x0000000106eb2835 _ZL10createMenuP8QMenuBar + 2149
      	19  qt5menubar                          0x0000000106eb1ddd main + 269
      	20  qt5menubar                          0x0000000106eb1cc4 start + 52
      	21  ???                                 0x0000000000000001 0x0 + 1
      )
      2016-11-30 23:08:07.600 qt5menubar[39068:2823790] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Item to be inserted into menu already is in another menu'
      *** First throw call stack:
      (
      	0   CoreFoundation                      0x00007fff9766c452 __exceptionPreprocess + 178
      	1   libobjc.A.dylib                     0x00007fff8f42073c objc_exception_throw + 48
      	2   CoreFoundation                      0x00007fff9767112a +[NSException raise:format:arguments:] + 106
      	3   Foundation                          0x00007fff8c414856 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
      	4   AppKit                              0x00007fff84986803 -[NSMenu insertItem:atIndex:] + 318
      	5   libqcocoa.dylib                     0x000000010af3aa04 _ZN10QCocoaMenu12insertNativeEP14QCocoaMenuItemS1_ + 452
      	6   libqcocoa.dylib                     0x000000010af3af94 _ZN10QCocoaMenu12syncMenuItemEP17QPlatformMenuItem + 500
      	7   libqcocoa.dylib                     0x000000010af3f144 _ZN13QCocoaMenuBar8syncMenuEP13QPlatformMenu + 372
      	8   libqcocoa.dylib                     0x000000010af3e446 _ZN13QCocoaMenuBar24updateMenuBarImmediatelyEv + 630
      	9   libqcocoa.dylib                     0x000000010af3ed1f _ZN13QCocoaMenuBar10insertMenuEP13QPlatformMenuS1_ + 1055
      	10  QtWidgets                           0x0000000107063954 _ZN8QMenuBar11actionEventEP12QActionEvent + 1140
      	11  QtWidgets                           0x0000000106f16db0 _ZN7QWidget5eventEP6QEvent + 384
      	12  QtWidgets                           0x0000000107063e92 _ZN8QMenuBar5eventEP6QEvent + 482
      	13  QtWidgets                           0x0000000106ed5746 _ZN19QApplicationPrivate13notify_helperEP7QObjectP6QEvent + 294
      	14  QtWidgets                           0x0000000106ed6ca8 _ZN12QApplication6notifyEP7QObjectP6QEvent + 504
      	15  QtCore                              0x0000000107df1f24 _ZN16QCoreApplication15notifyInternal2EP7QObjectP6QEvent + 164
      	16  QtWidgets                           0x0000000106f0ae2f _ZN7QWidget12insertActionEP7QActionS1_ + 431
      	17  QtWidgets                           0x0000000107062030 _ZN8QMenuBar7addMenuEP5QMenu + 32
      	18  qt5menubar                          0x0000000106eb2835 _ZL10createMenuP8QMenuBar + 2149
      	19  qt5menubar                          0x0000000106eb1ddd main + 269
      	20  qt5menubar                          0x0000000106eb1cc4 start + 52
      	21  ???                                 0x0000000000000001 0x0 + 1
      )
      libc++abi.dylib: terminating with uncaught exception of type NSException
      Abort trap: 6
      

      Attachments

        1. btqtc.txt
          5 kB
        2. qcocoamenu.diff
          1 kB
        3. qt5menubar.zip
          3 kB

        Issue Links

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

          Activity

            People

              dedietri Gabriel de Dietrich (drgvond)
              ls@4js.com Leo Schubert
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: