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

Compile Qt code with QT_NO_CONTEXTLESS_CONNECT

    XMLWordPrintable

Details

    • Epic
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Core: Other
    • None
    • no-contextless-connect
    • 4f52ce337 (dev), 6c248df68 (dev), 5fd77a994 (dev), 9ab265f0f (dev), fd6a895af (dev), f406c29b7 (dev), 978f90b10 (dev), 2eb5de595 (dev), a5461e5ed (dev), ed89905ad (dev), a90907970 (dev), 3d6f8ff6a (dev), e3d5549d7 (dev), 0ac61fbf6 (6.5), 417d48802 (dev)

    Description

      This affects building Qt code, not user code. I.e. the plan is to add:

      list(APPEND QT_EXTRA_INTERNAL_TARGET_DEFINES "QT_NO_CONTEXTLESS_CONNECT=1")
      

      to .cmake.conf in each Qt repo.

      Discussion and rationale on the mailing list:
      https://lists.qt-project.org/pipermail/development/2023-July/044141.html :

      The reason for NOT using the 3-args overload is that it is error prone.

      For starters, it makes it hard to reason about the lifetime of such a
      connection. It makes it very easy to connect to lambdas that capture
      some local state in the receiver, but when the receiver is destroyed,
      the connection isn't automatically disconnected (therefore, if the
      signal is emitted, the program will crash). Fixing this may or may not
      be straightforward, depending on how much state is captured.

      Second, it's also easy to forget that since there's no receiver/context,
      the connection is always forced to be direct, which complicates things
      if multiple threads are involved.

      This came up in code review, see mmutz's comment here https://codereview.qt-project.org/c/qt/qtvirtualkeyboard/+/491478

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            ahmad.samir Ahmad Samir
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes