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

QML properties don't hold reference of JavaScript objects

    XMLWordPrintable

Details

    Description

      JavaScript-owned QObject are not properly reference-counted and therefore destroyed when they are only referenced by QML properties.

      Text {
          property variant textHolder: null
      
          function createMessage()
          {
              {
                  textHolder = Constructor.createObject("Hello World!");
              }
              gc();
          }
      }
      

      In this example, textHolder object is destroyed when the GC runs. If I use JavaScript global variables, everything works as expected.

      Test project attached.

      Attachments

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

        Activity

          People

            chriadam Christopher Adams (closed Nokia identity) (Inactive)
            egergo Gergő Ertli
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes