Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Using "new Object" in QML/JavaScript are garbage collected correctly?
Forum Updated to NodeBB v4.3 + New Features

Using "new Object" in QML/JavaScript are garbage collected correctly?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 615 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jackmack
    wrote on last edited by
    #1

    Hi all,

    I'm using QML Quick 1.1 with Qt 4.8.6 on windows desktop.
    The GUI of my application is completely written in QML. The GUI logic is done via script files and uses JavaScript.

    Because some components like a property dialog is dynamically created I do following to get informed about the values: When one values was changed I iterate about all items, get their values, put the items name and value into a map and pass it to my C++ class.

    That works, no problem.
    @
    function valueChanged()
    {
    var values = new Object

    for (var i = 0; i < column.children.length; i++) {

    values[column.children[i].objectName] = column.children[i].text
    }

    myCppClass.changeValues(values)
    }
    @

    The "values" is a map, more precise a JavaScript Object with "new" created.

    My question here:
    What happens with the "values" after leaving the function? Is it destroyed by garbage collector? Or does it exists furher because I passed it to the C++ class?

    Thanks a lot...

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved