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

QWebChannel cannot emit signals from SIGNALS in different QThread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 6.2.0 Alpha
    • 5.4.1, 5.5.1
    • WebChannel
    • None
    • QWebChannel project's test folder, using Qt 5.5 layman overlay, installed on Gentoo Linux.
    • 7cb2d467c3421eced44ae7b887b8738cc68595fc

      Creating a class and moving it to a different QThread, and then emitting a signal from that thread causes QWebChannel to segfault.

      Issue seems to be caused by the use of QObject::sender() in signalhandler_p.hpp (qt_metacall). sender() which will be null if used from a different thread than the sender object's affinity.

      I believe this can be fixed by using Qt::AutoConnection in the connection type, though I'm not sure if this is safe without some feedback on whether this type of queuing would be correct in the overall architecture.

      Sample output without fix:
      QFATAL : TestWebChannel::testAsyncObject() Received signal 11
      FAIL! : TestWebChannel::testAsyncObject() Received a fatal error.
      Loc: [Unknown file(0)]
      Totals: 6 passed, 1 failed, 0 skipped, 0 blacklisted

                      • Finished testing of TestWebChannel *********
                        Aborted

      Debugging info:

      Program received signal
      SIGABRT, Aborted.
      0x00007ffff5552267 in raise () from /lib64/libc.so.6

          • Program received signal SIGABRT (Aborted) ***
            ASSERT: "object" in file signalhandler_p.h, line 253

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

            milianw Milian Wolff
            jetdog330 Dave Andrews
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There is 1 open Gerrit change