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

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.4, 6.3, 6.4
    • None
    • 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

        Activity

          People

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

            Dates

              Created:
              Updated: