Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-27770

Q_PROPERTY autocomplete should add pointer initialization

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Done
    • Affects Version/s: Qt Creator 8.0.0-beta1
    • Fix Version/s: Qt Creator 8.0.0-rc1
    • Component/s: Editors
    • Labels:
      None
    • Commits:
      d09081d07c (qt-creator/qt-creator/8.0) d09081d07c (qt-creator/tqtc-qt-creator/8.0)

      Description

      If I'm writing a property with a pointer type, like this

          Q_PROPERTY(QWindow* window READ window WRITE setWindow NOTIFY windowChanged)
      

      it should generate the storage variable like this

      private:
          QWindow *m_window = nullptr;
      

      Currently it's leaving it unintialized, so if I modify the setter to undo something with the previous one (like disconnecting signals or whatever), boom... it's a random dangling pointer.

        Attachments

        For Gerrit Dashboard: QTCREATORBUG-27770
        # Subject Branch Project Status CR V

          Activity

            People

            Assignee:
            davschul David Schulz
            Reporter:
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes