Details
-
Bug
-
Resolution: Unresolved
-
P1: Critical
-
None
-
6.8.2
-
None
Description
I'm seeing crashes in QQuickImageParticle when the window is moving between screens with different devicePixelRatio's. Here's a sample stack trace:
Qt6Quickd.dll!QQuickSpriteEngine::spriteWidth(int sprite) Line 255 C++ Qt6QuickParticlesd.dll!QQuickImageParticle::initialize(int gIdx, int pIdx) Line 1780 C++ Qt6QuickParticlesd.dll!QQuickParticlePainter::load(QQuickParticleData * d) Line 115 C++ Qt6QuickParticlesd.dll!QQuickParticleSystem::finishNewDatum(QQuickParticleData * pd) Line 945 C++ Qt6QuickParticlesd.dll!QQuickParticleSystem::emitParticle(QQuickParticleData * pd, QQuickParticleEmitter * particleEmitter) Line 932 C++ Qt6QuickParticlesd.dll!QQuickParticleEmitter::emitWindow(int timeStamp) Line 452 C++ Qt6QuickParticlesd.dll!QQuickParticleSystem::updateCurrentTime(int currentTime) Line 973 C++ Qt6QuickParticlesd.dll!QQuickParticleSystemAnimation::updateCurrentTime(int t) Line 448 C++
QQuickImageParticle will call createEngine at runtime in response to various events, including DPR changes. From what I can tell, this process is not instantaneous, and if particle emission happens in the right moment, the m_sprites array will be empty, and the rest of the code doesn't seem to handle that case.
Below is a reasonably minimal repro case. The bug can be triggered by either moving the window to a different-dpr screen (at least on Windows), or by clicking the window a few times. The MouseArea's onClicked handler triggers a change to the `sprites` list, which in turn triggers createEngine.
import QtQuick import QtQuick.Particles Window { width: 500 height: 500 visible: true ParticleSystem { anchors.fill: parent Sprite{ id: s1; source:"image.png"} Sprite{ id: s2; source:"image.png"} ImageParticle{ id: ipa sprites: [ s1 ] } MouseArea { anchors.fill: parent onClicked: { if(ipa.sprites.length == 1) ipa.sprites.push(s2) else ipa.sprites.length = 1 } } Emitter { id: emitter lifeSpan: 1500 velocity: AngleDirection { angleVariation: 360 magnitude: 15 } emitRate: 30 anchors.centerIn: parent } } }