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

Item's onDestroyed singnal called too late, element already deleted

    XMLWordPrintable

Details

    Description

      The Item's onDestroyed signal needs to be called while the element still
      exists to allow cleanup based on the item's reference. This does not appear
      to be the case, at least when the item is destroyed as a result of the QML app
      being reloaded.
      I.e. running this code

      Rectangle {
          id: rect
          color:"red"
      
          Component.onCompleted: print("Created " + rect.toString());
          onDestroyed: print("Destroyed " + rect.toString());   // results in "Result of expression 'rect' [undefined] is not an object."
      }
      

      then pressing Ctrl+R in the QML viewer to reload the application, rect is already
      "undefined" when onDestroyed is called. Is this also the case when e.g. a ListView
      deallocates a delegate?

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            mathiasm Mathias Malmqvist
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes