diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-10-14 11:06:01 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-10-19 15:00:40 +0200 |
commit | 691fdba5ec537e8ebcd4f98a18fabb2731668ef8 (patch) | |
tree | 7d622bd68aee8fcef1d731155481c9c38b7d0e5a /src | |
parent | 6de355e72ad7d855df9664ecbeb37b95f47d2d1a (diff) |
QQuickShaderEffect: fix crash when hiding parent
It's possible for itemChange to be called during destruction when
deleting the QQuickShaderEffectImpl. We nullify m_impl before deleting
it via another pointer to it, so we must check that it's not null
before trying to use it.
Fixes: QTBUG-86402
Change-Id: If4955445f7cc0d1f376bc9b86b95e1cca4d88ede
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit 266cd7638d887b31d56964a0f13fe208821703b1)
Diffstat (limited to 'src')
-rw-r--r-- | src/quick/items/qquickshadereffect.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/quick/items/qquickshadereffect.cpp b/src/quick/items/qquickshadereffect.cpp index 78458ce6b0..1d931a656f 100644 --- a/src/quick/items/qquickshadereffect.cpp +++ b/src/quick/items/qquickshadereffect.cpp @@ -843,7 +843,11 @@ void QQuickShaderEffect::itemChange(ItemChange change, const ItemChangeData &val return; } #endif - m_impl->handleItemChange(change, value); + // It's possible for itemChange to be called during destruction when deleting + // the QQuickShaderEffectImpl. We nullify m_impl before deleting it via another pointer + // to it, so we must check that it's not null before trying to use it here. + if (m_impl) + m_impl->handleItemChange(change, value); QQuickItem::itemChange(change, value); } |