Skip to content

Commit 0e259e2

Browse files
committed
fix: fix memory leak when cursor buffer is null
The code was incorrectly deleting the QSGNode directly when the cursor buffer is null, which could cause memory management issues. The proper way to handle node removal in Qt Quick Scene Graph is to mark the node as dirty with the DirtyNodeRemoved flag, allowing the scene graph to properly manage the node's lifecycle. Log: Influence: 1. Check that scene graph nodes are properly managed
1 parent ab189f5 commit 0e259e2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

waylib/src/server/qtquick/wquickcursor.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -575,7 +575,10 @@ QSGNode *WQuickCursor::updatePaintNode(QSGNode *node, UpdatePaintNodeData *)
575575

576576
// Ignore the tp->proxy, Don't use tp->qwBuffer()
577577
if (!tp->buffer) {
578-
delete node;
578+
if (node) {
579+
node->markDirty(QSGNode::DirtyNodeRemoved);
580+
}
581+
579582
return nullptr;
580583
}
581584

0 commit comments

Comments
 (0)