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

Qt::DirectConnection to a thread-safe function

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 5.12
    • Core: Threads
    • None

    Description

      With a connection such as:

      connect(workerThread, &WorkerThread::eventPending, dispatcherOfMainThread, &QAbstractEventDispatcher::wakeUp, Qt::DirectConnection);

      its possible to crash with the following backtrace:

      (gdb) bt
              #0  QObjectCleanupHandler::clear (this=this@entry=0x5a6860) at kernel/qobjectcleanuphandler.cpp:138
              #1  0x00007ffff6bb7e59 in QObjectCleanupHandler::~QObjectCleanupHandler (this=0x5a6860, __in_chrg=<optimized out>) at kernel/qobjectcleanuphandler.cpp:85
              #2  0x00007ffff6bb7e75 in QObjectCleanupHandler::~QObjectCleanupHandler (this=0x5a6860, __in_chrg=<optimized out>) at kernel/qobjectcleanuphandler.cpp:86
              #3  0x00007ffff0023654 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (QAbstractEventDispatcher::*)()>::call(void (QAbstractEventDispatcher::*)(), QAbstractEventDispatcher*, void**) (arg=<optimized out>,
                  o=<optimized out>, f=<optimized out>) at ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:152
              #4  QtPrivate::FunctionPointer<void (QAbstractEventDispatcher::*)()>::call<QtPrivate::List<>, void>(void (QAbstractEventDispatcher::*)(), QAbstractEventDispatcher*, void**) (arg=<optimized out>, o=<optimized out>, f=<optimized out>)
              at ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:185
          #5  QtPrivate::QSlotObject<void (QAbstractEventDispatcher::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=<optimized out>, this_=<optimized out>, r=<optimized out>, a=<optimized out>,
              ret=<optimized out>) at ../../../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:414
          #6  0x00007ffff6bad41d in QtPrivate::QSlotObjectBase::call (a=<optimized out>, r=0x5a6860, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:394
          #7  QMetaObject::activate (sender=sender@entry=0x441c40, signalOffset=<optimized out>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3761
          #8  0x00007ffff6bad8e3 in QMetaObject::activate (sender=sender@entry=0x441c40, m=m@entry=0x7ffff011cba0 <QXcbEventReader::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x0) at kernel/qobject.cpp:3640
          #9  0x00007ffff004f234 in QXcbEventReader::eventsPending (this=this@entry=0x441c40) at .moc/moc_qxcbeventreader.cpp:130
          #10 0x00007ffff00232d2 in QXcbEventReader::run (this=0x441c40) at qxcbeventreader.cpp:154
          #11 0x00007ffff69a4454 in QThreadPrivate::start (arg=0x441c40) at thread/qthread_unix.cpp:361
          #12 0x00007ffff59686ba in start_thread (arg=0x7fffec859700) at pthread_create.c:333
          #13 0x00007ffff608f41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      

      It is unclear from a documentation if direct connection to thread-safe functions between threads is supported by signal and slot connections. No warnings are printed in a console, so I assume this is a valid bug? If yes, then I can try to provide a reproducible test code.

      Attachments

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

        Activity

          People

            thiago Thiago Macieira
            paeglis Gatis Paeglis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes