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

Crash when pressing keys on macOS in debug build

    XMLWordPrintable

    Details

    • Platform/s:
      macOS
    • Commits:
      f3e861819d0303f7d69d17990f45177df65eaec7 (qt/qtbase/6.1)

      Description

      We encounter problems with a debug build of the qt library on macOS only. When pressing certain keys, an assertion is triggered in QAppleKeyMapper:

      Assert: In "qtbase/include/QtCore/../../src/corelib/text/qchar.h", line 114:
       ASSERT: "rc <= 0xffff" in file qtbase/include/QtCore/../../src/corelib/text/qchar.h, line 114

      Along with the following backtrace:

      Backtrace (please include this in your support request):
       0# Ur::MessageHandler::print(Ur::Message&) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       1# Ur::print(Ur::Message&) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       2# void Ur::printf<char const*>(unsigned long long, Ur::Location const&, char const*, char const* const&) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       3# handleQtMessages(QtMsgType, QMessageLogContext const&, QString const&) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       4# qt_message_print(QtMsgType, QMessageLogContext const&, QString const&) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       5# qt_message(QtMsgType, QMessageLogContext const&, char const*, __va_list_tag*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       6# QMessageLogger::fatal(char const*, ...) const in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       7# qt_assert_x(char const*, char const*, char const*, int) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       8# QAppleKeyMapper::possibleKeys(QKeyEvent const*) const (.cold.4) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       9# QAppleKeyMapper::possibleKeys(QKeyEvent const*) const in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       10# non-virtual thunk to QCocoaIntegration::possibleKeys(QKeyEvent const*) const in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       11# QKeyMapperPrivate::possibleKeys(QKeyEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       12# QKeyMapper::possibleKeys(QKeyEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       13# QShortcutMap::createNewSequences(QKeyEvent*, QList<QKeySequence>&, int) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       14# QShortcutMap::find(QKeyEvent*, int) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       15# QShortcutMap::nextState(QKeyEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       16# QShortcutMap::tryShortcut(QKeyEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       17# QWindowSystemInterface::handleShortcutEvent(QWindow*, unsigned long, int, QFlags<Qt::KeyboardModifier>, unsigned int, unsigned int, unsigned int, QString const&, bool, unsigned short) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtGui.framework/Versions/A/QtGui
       18# -[QNSView(Keys) handleKeyEvent:eventType:] in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       19# -[QNSView(Keys) keyDown:] in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       20# -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       21# -[NSWindow(NSEventRouting) sendEvent:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       22# -[QNSPanel sendEvent:] in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       23# -[NSApplication(NSEvent) sendEvent:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       24# -[QNSApplication sendEvent:] in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       25# -[NSApplication _doModalLoop:peek:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       26# __33-[NSApplication runModalSession:]_block_invoke_2 in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       27# __33-[NSApplication runModalSession:]_block_invoke in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       28# _NSTryRunModal in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       29# -[NSApplication runModalSession:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       30# QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       31# QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       32# QDialog::exec() in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtWidgets.framework/Versions/A/QtWidgets
       33# MainWindow::on_actionOpen_triggered() in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       34# QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (MainWindow::)()>::call(void (MainWindow::)(), MainWindow*, void**) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       35# void QtPrivate::FunctionPointer<void (MainWindow::)()>::call<QtPrivate::List<>, void>(void (MainWindow::)(), MainWindow*, void**) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       36# QtPrivate::QSlotObject<void (MainWindow::)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase, QObject*, void*, bool) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       37# QObject::event(QEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       38# QWidget::event(QEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtWidgets.framework/Versions/A/QtWidgets
       39# QMainWindow::event(QEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtWidgets.framework/Versions/A/QtWidgets
       40# QApplicationPrivate::notify_helper(QObject*, QEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtWidgets.framework/Versions/A/QtWidgets
       41# QApplication::notify(QObject*, QEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtWidgets.framework/Versions/A/QtWidgets
       42# QCoreApplication::notifyInternal2(QObject*, QEvent*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       43# QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       44# QCocoaEventDispatcherPrivate::processPostedEvents() in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       45# QCocoaEventDispatcherPrivate::postedEventsSourceCallback(void*) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       46# _CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_ in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       47# __CFRunLoopDoSource0 in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       48# __CFRunLoopDoSources0 in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       49# __CFRunLoopRun in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       50# CFRunLoopRunSpecific in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
       51# RunCurrentEventLoopInMode in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       52# ReceiveNextEventCommon in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       53# _BlockUntilNextEventMatchingListInModeWithFilter in /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
       54# _DPSNextEvent in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       55# -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       56# -[NSApplication run] in /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit
       57# QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/plugins/platforms/libqcocoa.dylib
       58# QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       59# QCoreApplication::exec() in /Users/janpohland/absint/git/build/a3c_devel.default.O0/usr/lib/QtCore.framework/Versions/A/QtCore
       60# main in /Users/janpohland/absint/git/build/a3c_devel.default.O0/astreegui/a3c
       61# start in /usr/lib/system/libdyld.dylib
       62# 0x0000000000000003
      

      It looks like event->key() returns, e.g., a value of  0x01000000 for the escape key which triggers the assertion:

      Qt6/6.1.0/Src/qtbase/src/corelib/text/qchar.h:
       > constexpr QCHAR_MAYBE_IMPLICIT QChar(uint rc) noexcept : ucs((Q_ASSERT(rc <= 0xffff), char16_t(rc))) {}
       > constexpr QCHAR_MAYBE_IMPLICIT QChar(int rc) noexcept : QChar(uint(rc)) {}

      Is this a problem in the debug build of the Qt library or do we need a special flag for our macOS compile?

        Attachments

        For Gerrit Dashboard: QTBUG-92891
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            vestbo Tor Arne Vestbø
            Reporter:
            mlangen Marc Langenbach
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes