Clarification on QSGNode::preprocess()

  • In the QSGNode preprocess() docs it says:
    Warning: Beware of deleting nodes while they are being preprocessed. It is possible, with a small performance hit, to delete a single node during its own preprocess call. Deleting a subtree which has nodes that also use preprocessing may result in a segmentation fault. This is done for performance reasons.

    Referring to the "QtQuick scene graph docs":,

    From what I can tell, QSGNode::preprocess() is called by the render thread. Scene manipulation (addition/removal of nodes) is also done by the render thread in QQuickItem::updatePaintNode(). Where can nodes be deleted such that I'd get a segmentation fault or other bad behavior?

  • Is that a typo or are you asking how you can produce segfaults by deleting scene nodes?

  • It's not a typo. I don't understand what conditions cause seg faults when I delete scene nodes. I'm pretty confused in general on how to deal with the new scene graph stuff since there's a separate render thread asynchronously doing stuff.

    If I have some custom opengl rendering in a QSGNode in the preprocess() call, will I get a seg fault when someone changes the QQuickView to another QML file and parts of my scene graph get deleted?

Log in to reply

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