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

QPrivateSignal: The signal can be signaled from outside contexts using string-based lookup

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 6.2.4, 6.3, 6.4
    • Fix Version/s: None
    • Labels:
      None
    • Platform/s:
      All

      Description

      Adding QPrivateSignal as an argument to the signal is meant to make it impossible to call from any other class than the owning class.
      However, moc generates, in qt_static_metacall, the call for InvokeMetaMethod with the QPrivateSignal argument. For example:

              case 1: _t->pendingConnectionAvailable(QPrivateSignal()); break;
      

      This means it is possible to still emit the signal by using the string-based lookup. Like so:

              QMetaObject::invokeMethod(this, "pendingConnectionAvailable");
      

      The code snippet above was added to the patch below inside the DerivedServer::incomingConnection function, where 'pendingConnectionAvailable' is a private signal on the parent, QTcpServer.

      See following patch for where the code is generated from/added to:
      https://codereview.qt-project.org/c/qt/qtbase/+/413535

        Attachments

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

          Activity

            People

            Assignee:
            cnn Qt Core & Network
            Reporter:
            manordheim MÃ¥rten Nordheim
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes