Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Correctly tearing down a QQuickView- derived window

Correctly tearing down a QQuickView- derived window

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 3.9k 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.
  • D Offline
    D Offline
    danielbsig
    wrote on last edited by
    #1

    Hi,

    I have a window which will be displayed to the user on a regular basis, and I'm using a class derived from QQuickView, setting the source property in the constructor.

    I was having problems when my windows was supposed to be displayed for the second time, my program would crash without any warning. More specifically, the only output I would get in the output window was:

    The program has unexpectedly finished.

    Initially, the plan was to call setSource() each time the window would be displayed, in order to ensure all timers etc. would be reset for the second time. When these problems occurred, I switched over to adding a JavaScript function in my .qml file, which took care of resetting everything, and only calling setSource once (at startup), but the problem didn't go away, now I got this error:

    ASSERT failure in QSGNode::appendChildNode: "QSGNode already has a parent", file scenegraph\coreapi\qsgnode.cpp, line 404

    Finally, I decided to throw away my object each time after being done using it (basically by calling delete on the object, I also tried calling close() and/or destroy() before that), and re-create it the next time the window should be displayed. But that gives me an error when I try to destroy my QQuickView-derived object for the first time, with the following assertion:

    ASSERT: "context() && engine()" in file qml\qqmlboundsignal.cpp, line 140

    So, what is the proper method to display the same window repeatedly? Or what is the proper method to correctly destroy such an object?

    Best regards,
    Daniel

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Try calling ::deleteLater().

      (Z(:^

      1 Reply Last reply
      0
      • S Offline
        S Offline
        swegmann
        wrote on last edited by
        #3

        Although this is an old thread, I wanted to remark that sierdzio's reply helped me at least with the part about

        ASSERT: “context() && engine()” in file qml\qqm.....

        in the above post. Calling deleteLater() on the object created by component.create() fixed my issues.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          swegmann
          wrote on last edited by
          #4

          Although this is an old thread, I wanted to remark that sierdzio's reply helped me at least with the part about

          ASSERT: “context() && engine()” in file qml\qqm.....

          in the above post. Calling deleteLater() on the object created by component.create() fixed my issues.

          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