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



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

    stack.push(Qt.resolvedUrl("SomePage.qml"))
    

    the pages have the following "close" button handler:

    Page {
        id: root
    
        function close()
        {
            stack.pop()
            root.destroy(1000)
        }
    }
    

    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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.