Skip to content

Commit

Permalink
sync: from linuxdeepin/dtkdeclarative
Browse files Browse the repository at this point in the history
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#409
  • Loading branch information
deepin-ci-robot committed Oct 22, 2024
1 parent 13a2c40 commit 03739eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/private/dquickbehindwindowblur.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class Q_DECL_HIDDEN DSGBlendNode : public QSGRenderNode
void sync(DQuickBehindWindowBlur *blur);
protected:
inline QQuickWindow *window() const {
return Q_LIKELY(m_item) ? m_item->window() : nullptr;
return Q_LIKELY(!m_item.isNull()) ? m_item->window() : nullptr;
}

bool m_isRestore = false;
DQuickBehindWindowBlur *m_item = nullptr;
QPointer<DQuickBehindWindowBlur> m_item = nullptr;
QMatrix4x4 m_lastMatrix;
QRegion m_lastClip;
qreal m_lastRadius = -1;
Expand All @@ -47,11 +47,15 @@ DSGBlendNode::DSGBlendNode(bool restore)

void DSGBlendNode::render(const QSGRenderNode::RenderState *state)
{
Q_ASSERT(m_item);
// m_item may become invalid when the referred blur behind item get destroyed by a Loader.
// Give up rendering in this case.
if (!m_item)
return;

if (m_isRestore)
return;


if (QSGRendererInterface::Software == window()->rendererInterface()->graphicsApi()) {
QSGRendererInterface *rif = window()->rendererInterface();
QPainter *p = static_cast<QPainter *>(rif->getResource(window(), QSGRendererInterface::PainterResource));
Expand Down

0 comments on commit 03739eb

Please sign in to comment.