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

QObject::diconnectNotify is not called when receiver is destroyed

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 4.5.1
    • Fix Version/s: 5.0.0
    • Component/s: Core: Object Model
    • Labels:
      None
    • Commits:
      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

            Assignee:
            kenthans Kent Hansen (Inactive)
            Reporter:
            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