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

Issues with extending Edit menu on macOS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.4.0
    • GUI: Menus
    • None
    • macOS

    Description

      In our application we update the menu bar depending on the view that is currently displayed. Some views can also be detached from the main window and appear in their own instance of a QMainWindow. When detaching, the views actions and menus are also transferred. Of course such a detached view can again be re-attached to the main window.

      On macOS there is some magic that occurs when adding an "Edit" menu to the menu bar: some default edit items are appended (like "Start dictation" and "Emoji & Symbols") to the Edit menu. These new actions trigger eventually crashes when the Edit menu gets transferred to a different QMainWindow.

      In a debug build we see (one of) the following messages right before the crash occurs: 

      Warning: Debug: Menu item "" already in menu "Edit"
      Warning: Debug: Menu item "Start Dictation..." already in menu "Edit"
      Warning: Debug: Menu item "Emoji && Symbols" already in menu "Edit"
      Warning: Debug: Item to remove does not belong to this menu

       A debugger pointed to this problem: 

      2022-10-13 11:19:56.164 a3c[58525:4531717] *** -[QCocoaNSMenuItem isSeparatorItem]: message sent to deallocated instance 0x60000032e980

       The backtrace we get looks as follows: 

      Assert: Caught fatal signal 11 (Segmentation Violation).
       Please report this problem to our support.
       Program: a³ C, Release: 22.10, Build: 11844004, Tag: auto/2022/10/11/1918
       
       Backtrace (please include this in your support request):
       0# Ur::MessageHandler::print(Ur::Message&) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       1# void Ur::printf<int, char*>(unsigned long long, char const*, int const&, char* const&) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       2# Ur::Application::catchSignal(int) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       3# _sigtramp in /usr/lib/system/libsystem_platform.dylib
       4# 0x0000000000000001
       5# QCocoaMenu::syncMenuItem_helper(QPlatformMenuItem*, bool) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/PlugIns/platforms/libqcocoa.dylib
       6# QCocoaMenuBar::syncMenu_helper(QPlatformMenu*, bool) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/PlugIns/platforms/libqcocoa.dylib
       7# QCocoaMenuBar::insertMenu(QPlatformMenu*, QPlatformMenu*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/PlugIns/platforms/libqcocoa.dylib
       8# QMenuBar::actionEvent(QActionEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       9# QWidget::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       10# QApplicationPrivate::notify_helper(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       11# QApplication::notify(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       12# QCoreApplication::notifyInternal2(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       13# QWidget::insertAction(QAction*, QAction*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       14# QMenuBar::addMenu(QMenu*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       15# DetachedWindow::updateTemporaryActions(AstreeViewItem*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       16# DetachedWindow::on_wStack_currentChanged(int) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       17# DetachedWindow::qt_metacall(QMetaObject::Call, int, void**) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       18# QMetaObject::activate(QObject*, QMetaObject const*, int, void**) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       19# QStackedWidget::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       20# QMetaObject::activate(QObject*, QMetaObject const*, int, void**) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       21# QStackedLayout::setCurrentIndex(int) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       22# QStackedLayout::takeAt(int) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       23# QLayout::activate() in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       24# QLayout::addChildWidget(QWidget*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       25# QStackedLayout::insertWidget(int, QWidget*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       26# ViewManager::attachView(AstreeViewItem*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       27# QMetaObject::activate(QObject*, QMetaObject const*, int, void**) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       28# DetachedWindow::attach(AstreeViewItem*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       29# DetachedWindow::closeEvent(QCloseEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       30# QWidget::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       31# QMainWindow::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       32# QApplicationPrivate::notify_helper(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       33# QApplication::notify(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       34# QCoreApplication::notifyInternal2(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       35# QWidgetPrivate::handleClose(QWidgetPrivate::CloseMode) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       36# QWidgetPrivate::invalidateBackingStore_resizeHelper(QPoint const&, QSize const&) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       37# QWindow::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtGui.framework/Versions/A/QtGui
       38# QApplicationPrivate::notify_helper(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       39# QApplication::notify(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       40# QCoreApplication::notifyInternal2(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       41# QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtGui.framework/Versions/A/QtGui
       42# void QWindowSystemInterface::handleThemeChange<QWindowSystemInterface::AsynchronousDelivery>(QWindow*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtGui.framework/Versions/A/QtGui
       43# QWindow::close() in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtGui.framework/Versions/A/QtGui
       44# QObject::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       45# QWidget::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       46# QMainWindow::event(QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       47# QApplicationPrivate::notify_helper(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       48# QApplication::notify(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtWidgets.framework/Versions/A/QtWidgets
       49# QCoreApplication::notifyInternal2(QObject*, QEvent*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       50# QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       51# QCocoaEventDispatcherPrivate::processPostedEvents() in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/PlugIns/platforms/libqcocoa.dylib
       52# QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/PlugIns/platforms/libqcocoa.dylib
       53# __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       54# __CFRunLoopDoSource0 in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       55# __CFRunLoopDoSources0 in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       56# __CFRunLoopRun in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       57# CFRunLoopRunSpecific in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       58# RunCurrentEventLoopInMode in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       59# ReceiveNextEventCommon in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       60# _BlockUntilNextEventMatchingListInModeWithFilter in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       61# _DPSNextEvent in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       62# -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       63# -[NSApplication run] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       64# QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/PlugIns/platforms/libqcocoa.dylib
       65# QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       66# QCoreApplication::exec() in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/Frameworks/QtCore.framework/Versions/A/QtCore
       67# main in /Users/straub/Desktop/a3_c_macos64_b11844004_release.app/Contents/MacOS/a3c
       68# 0x000000011720551E
       
      
      

       

      Attachments

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

        Activity

          People

            tpochep Timur Pocheptsov
            mlangen Marc Langenbach
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes