diff options
author | Martin T. H. Sandsmark <martin.sandsmark@kde.org> | 2017-03-12 15:03:56 +0100 |
---|---|---|
committer | Robin Burchell <robin.burchell@crimson.no> | 2017-04-05 20:56:31 +0000 |
commit | 8b255c67b965cda334425d64a0f1fd13ace93584 (patch) | |
tree | e41a9e8326e7fff9d5915111efb7849af57fe5dd /src/particles | |
parent | 22c39eda8ab316c743d0beac62a9745fd82147f7 (diff) |
QQuickParticleSystem: Fix crash when an Affector dies
A guarded pointer wasn't checked before being de-referenced, that lead
to a crash if an emitter was modified after an affector was deleted, but
before updateCurrentTime() was called.
Change-Id: I6cb605a711319fb77c1e2e87fa9f35427cd7797b
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
Diffstat (limited to 'src/particles')
-rw-r--r-- | src/particles/qquickparticlesystem.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/particles/qquickparticlesystem.cpp b/src/particles/qquickparticlesystem.cpp index 99e278238b..6f134f08df 100644 --- a/src/particles/qquickparticlesystem.cpp +++ b/src/particles/qquickparticlesystem.cpp @@ -668,8 +668,11 @@ void QQuickParticleSystem::setPaused(bool arg) { if (m_animation && m_animation->state() != QAbstractAnimation::Stopped) m_paused ? m_animation->pause() : m_animation->resume(); if (!m_paused) { - foreach (QQuickParticlePainter *p, m_painters) - p->update(); + foreach (QQuickParticlePainter *p, m_painters) { + if (p) { + p->update(); + } + } } emit pausedChanged(arg); } @@ -873,8 +876,11 @@ void QQuickParticleSystem::emittersChanged() if (particleCount > bySysIdx.size())//New datum requests haven't updated it bySysIdx.resize(particleCount); - foreach (QQuickParticleAffector *a, m_affectors)//Groups may have changed - a->m_updateIntSet = true; + foreach (QQuickParticleAffector *a, m_affectors) {//Groups may have changed + if (a) { + a->m_updateIntSet = true; + } + } foreach (QQuickParticlePainter *p, m_painters) loadPainter(p); |