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

QObject::diconnectNotify is not called when receiver is destroyed

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.0.0
    • 4.5.1
    • Core: Object Model
    • None
    • d359b0af2b93aeb9c22714be1cec881417650ed8

    Description

      Platform : Windows XP
      Platform details: Service Pack 2
      Compilers : MSVC
      Compiler details : Microsoft Visual Studio 2008 Service Pack 1

      Steps to reproduce / test case

      main.cpp
      #include <QObject>
      
      class DisconnectTest: public QObject
      {
          Q_OBJECT
      
              signals:
              void testSignal();
      
      protected:
          void connectNotify(char const * signal)
          {
              std::cout << "signal \"" << signal << "\" connected" << std::endl;
          }
      
          void disconnectNotify(char const * signal)
          {
              std::cout << "signal \"" << signal << "\" disconnected" << std::endl;
          }
      };
      
      int main()
      {
          QObject * dummy = new QObject;
          DisconnectTest * test = new DisconnectTest;
      
          // the slot does not matter here, we never emit the signal anyway
          QObject::connect(test, SIGNAL(testSignal()), dummy, SLOT(deleteLater()));
      
          // here the disconnectNotify() should be called (the receiver is destroyed and the slot is disconnected), but it does not
          delete dummy;
      
          // cleanup
          delete test;
      
          return 0;
      }
      

      Attachments

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

        Activity

          People

            kenthans Kent Hansen (Inactive)
            isdale Keith Isdale (closed Nokia identity) (Inactive)
            Votes:
            7 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes