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

QObject::disconnect() fails with PMF to subclass

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.3.2
    • 5.3.1
    • Core: Object Model
    • None
    • openSUSE Linux 13.1
    • Ia546fc8f36e1ea0dd0645bdd820aea47f43677ac

    Description

      When invoking QObject::disconnect() with a member function pointer for a subclass of the class the signal is defined in, the signal isn't found. While QObject::connectImpl() iterates through the meta objects of superclasses to find the signal, QObject::disconnectImpl() checks only the given meta object itself. Example:

      #include <QTcpSocket>
      
      int main(int , char **)
      {
      	QTcpSocket socket;
      	void (QTcpSocket::* socketErrorSignal)(QAbstractSocket::SocketError) = &QTcpSocket::error;
      	QObject::connect(&socket, socketErrorSignal, &socket, &QObject::deleteLater);
      		// ^ succeeds
      	QObject::disconnect(&socket, socketErrorSignal, &socket, &QObject::deleteLater);
      		// ^ fails
      	return 0;
      }
      

      Attachments

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

        Activity

          People

            ogoffart Olivier Goffart (Woboq GmbH)
            bonefish Ingo Weinhold
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes