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

QObject::disconnect() fails with PMF to subclass

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: 5.3.1
    • Fix Version/s: 5.3.2
    • Component/s: Core: Object Model
    • Labels:
      None
    • Environment:
      openSUSE Linux 13.1
    • Commits:
      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

            Assignee:
            ogoffart Olivier Goffart (Woboq GmbH)
            Reporter:
            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