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

QMap requires a public destructor in Qt 5, it is a behavioral change since Qt 4 and it is not documented

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.0.2
    • Documentation
    • None

    Description

      In Qt 4 it was possible to have a private destructor in a class that was using QMap, but in Qt 5 this is not possible.

      In Qt/qtbase/corelib/tools/qmap.h destroySubTree()

      template <class Key, class T>
      void QMapNode<Key, T>::destroySubTree()
      {
          if (QTypeInfo<Key>::isComplex)
              key.~Key();
          if (QTypeInfo<T>::isComplex)
              value.~T();
      

      the destructor is called directly instead of delete. Is there a reasoning behind this? If yes, then it must be documented to be a requirement for QMap.

      Attachments

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

        Activity

          People

            kandeler Christian Kandeler
            qtcomsupport Qt Support
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes