Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/private/dquickinwindowblur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ QSGNode *DQuickInWindowBlur::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
blurNode->setRenderCallback(onRender, this);
node->appendChildNode(blurNode);
node->setRenderCallback(updateBlurNodeTexture, blurNode);
connect(this, &QObject::destroyed, this, [node, blurNode](){

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

正常情况下, quickitem销毁了, node应该也被销毁把, 不需要去重置这个callback,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

node可能会比item晚一点销毁,因为渲染可能是在一个新线程里,如果在渲染中销毁了item,它的node是不会立即销毁的。但是这里也不应该这样改,应该在 node 调用 callback之前检查 setRenderCallback中给出来的第二个参数。

// fix callback crashed...
blurNode->setRenderCallback(nullptr, nullptr);
node->setRenderCallback(nullptr, nullptr);
});
}
#ifndef QT_NO_OPENGL
else if (ga == QSGRendererInterface::OpenGL
Expand All @@ -138,6 +143,11 @@ QSGNode *DQuickInWindowBlur::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
blurNode->setRenderCallback(onRender, this);
node->appendChildNode(blurNode);
node->setRenderCallback(updateBlurNodeTexture, blurNode);
connect(this, &QObject::destroyed, this, [node, blurNode](){
// fix callback crashed...
blurNode->setRenderCallback(nullptr, nullptr);
node->setRenderCallback(nullptr, nullptr);
});
}
#endif
else {
Expand Down