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

QTextDocument::contentsChanged emitted on modifier keys on Wayland

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 5.14.2
    • GUI: Text handling
    • None
    • Ubuntu 20.10
    • Linux/Wayland

    Description

      If I have a Qt app open either under Wayland or XWayland, and select a QTextDocument then:

      • Hit modifier keys, e.g. ctrl.
      • Select another window.

      In either order, I see QTextDocument::contentsChanged emitted even though contents have not changed. See backtrace:

      #0  EditWidget::setModified(bool) (this=0x55624408b530, state=true) at /home/abilinski/builds/keepassxc/src/gui/EditWidget.cpp:148                                                                                 
      #1  0x00007fd8f7aa8320 in doActivate<false>(QObject*, int, void**) (sender=0x5562440df9d0, signal_index=7, argv=0x7ffdf16ea8b0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:395
      #2  0x00007fd8f7aa8320 in doActivate<false>(QObject*, int, void**) (sender=0x5562440e3b10, signal_index=3, argv=0x7ffdf16ea990) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:395
      #3  0x00007fd8f88250a3 in QWidgetTextControl::qt_metacall(QMetaObject::Call, int, void**) (this=0x5562440e3b10, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7ffdf16eaaa0)
          at .moc/moc_qwidgettextcontrol_p.cpp:489
      #4  0x00007fd8f7aa8030 in doActivate<false>(QObject*, int, void**) (sender=0x5562440e60c0, signal_index=4, argv=0x7ffdf16eaaa0, argv@entry=0x0) at /usr/include/c++/10/bits/atomic_base.h:741
      #5  0x00007fd8f7aa2068 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**)
          (sender=<optimized out>, m=m@entry=0x7fd8f84b7820 <QTextDocument::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3930
      #6  0x00007fd8f83abc07 in QTextDocument::contentsChanged() (this=<optimized out>) at .moc/moc_qtextdocument.cpp:427
      #7  0x00007fd8f807c724 in QTextDocumentPrivate::finishEdit() (this=0x5562440e69b0) at text/qtextdocument_p.cpp:1247
      #8  0x00007fd8f807cb1c in QTextDocumentPrivate::endEditBlock() (this=<optimized out>) at text/qtextdocument_p.cpp:1203
      #9  QTextDocumentPrivate::endEditBlock() (this=<optimized out>) at text/qtextdocument_p.cpp:1186
      

      This causes apps to misbehave, and prompt for saving changes, which causes confusion as a user, making me unsure if I either made accidental changes that should be discarded or intentional changes that must be saved.

      Issue originally noticed using KeepassXC here: https://github.com/keepassxreboot/keepassxc/issues/4338#issuecomment-774945616

      Attachments

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

        Activity

          People

            esabraha Eskil Abrahamsen Blomfeldt
            anthony.bilinski Anthony Bilinski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes