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

QScopedPointer destructor calls cleanup handler when pointer is null

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P4: Low
    • Some future release
    • 4.6.2
    • Documentation
    • None

    Description

      When a QScopedPointer object is destroyed, the cleanup handler is called
      even after take() has been called on the scoped pointer.
      This constrains any custom cleanup handler to check whether the pointer is null or not.
      One could expect to do the following :

      struct MyObjectDeleter
      {
        static inline void cleanup(MyObject * object)
        {
            object->destroy(true);
        }
      };
      

      If this behavior can't be changed, maybe the documentation could explicitly state that
      null pointers have to be expected when writing a custom cleanup handler.

      Attachments

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

        Activity

          People

            docteam Qt Documentation Team
            jbrouault Jean-Baptiste Rouault
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes