Important: Please read the Qt Code of Conduct -

Should I call page.destroy() when a page is closed?

  • I have a StackView where I add some pages with QML code like this:


    the pages have the following "close" button handler:

    Page {
        id: root
        function close()

    When close() is called I get "Error: Invalid attempt to destroy() an indestructible object" message in the application output.

    What does it mean? Why a page is indestructible? Should I remove this destroy() call?

  • Looks like stack.pop() is still in progress when an attempt to destroy the page is made.

Log in to reply