Crash when deleteLater() QML Video component in Qt 5.12.4-5.13.1, but not in Qt.5.12.3
-
I create QML video component from within C++
QQmlComponent component(qmlEngine, QUrl::fromLocalFile("Video.qml")); QQmlContext* rootItemContext = QQmlEngine::contextForObject(rootWindow); QQuickItem *video= qobject_cast<QQuickItem*>(component.beginCreate(rootItemContext)); if(video != nullptr) { QQmlEngine::setObjectOwnership(video, QQmlEngine::CppOwnership); video->setParentItem(rootWindow->contentItem()); video->setParent(qmlEngine); // set video properties... } component.completeCreate();
video.qml is simple:
import QtQuick 2.0 import QtMultimedia 5.13 Video { id: video source: "video.mp4" width: 800 height: 400 x: 0 y: 0 autoPlay: 1 }
I remove the video later:
video->deleteLater();
It works exactly as I expect in Qt 5.12.3. But in Qt 5.13 the application crashes.
I can see in Event Viewer that the problem is with Qt5Muldimedia.dllFaulting application name: app.exe, version: 0.0.0.0, time stamp: 0x5d0a9f7a Faulting module name: Qt5Multimedia.dll, version: 5.13.0.0, time stamp: 0x5d027ea9 Exception code: 0xc0000005 Fault offset: 0x000000000004e740 Faulting process id: 0xc4c Faulting application start time: 0x01d53c821dd1a2fd Faulting application path: C:\Program Files\app\bin\app.exe Faulting module path: C:\Program Files\qml\qt\Qt5Multimedia.dll Faulting package full name: Faulting package-relative application ID:
Fault bucket 2258054399709010408, type 4 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: app.exe P2: 0.0.0.0 P3: 5d0a9f7a P4: Qt5Multimedia.dll P5: 5.13.0.0 P6: 5d027ea9 P7: c0000005 P8: 000000000004e740 P9: P10:
I wonder whether the way I remove the video component is wrong or there is a bug in Qt 5.13?
How can I investigate more what really happens there?
I also add that I remove video component when it is playing, but stopping before delete does not change anything. -
Fix will be introduced in 5.13.2 and 5.14.0 Alpha.
If you do not want to wait, you can make needed changes to the source code and built it yourself.
In file: src/plugins/common/evr/evrcustompresenter.cpp change line 1146 fromif (m_renderState == RenderStopped && m_surface->isActive()) {
to:
if (m_renderState == RenderStopped && m_surface && m_surface->isActive()) {
See issue for more information.
-
I create QML video component from within C++
QQmlComponent component(qmlEngine, QUrl::fromLocalFile("Video.qml")); QQmlContext* rootItemContext = QQmlEngine::contextForObject(rootWindow); QQuickItem *video= qobject_cast<QQuickItem*>(component.beginCreate(rootItemContext)); if(video != nullptr) { QQmlEngine::setObjectOwnership(video, QQmlEngine::CppOwnership); video->setParentItem(rootWindow->contentItem()); video->setParent(qmlEngine); // set video properties... } component.completeCreate();
video.qml is simple:
import QtQuick 2.0 import QtMultimedia 5.13 Video { id: video source: "video.mp4" width: 800 height: 400 x: 0 y: 0 autoPlay: 1 }
I remove the video later:
video->deleteLater();
It works exactly as I expect in Qt 5.12.3. But in Qt 5.13 the application crashes.
I can see in Event Viewer that the problem is with Qt5Muldimedia.dllFaulting application name: app.exe, version: 0.0.0.0, time stamp: 0x5d0a9f7a Faulting module name: Qt5Multimedia.dll, version: 5.13.0.0, time stamp: 0x5d027ea9 Exception code: 0xc0000005 Fault offset: 0x000000000004e740 Faulting process id: 0xc4c Faulting application start time: 0x01d53c821dd1a2fd Faulting application path: C:\Program Files\app\bin\app.exe Faulting module path: C:\Program Files\qml\qt\Qt5Multimedia.dll Faulting package full name: Faulting package-relative application ID:
Fault bucket 2258054399709010408, type 4 Event Name: APPCRASH Response: Not available Cab Id: 0 Problem signature: P1: app.exe P2: 0.0.0.0 P3: 5d0a9f7a P4: Qt5Multimedia.dll P5: 5.13.0.0 P6: 5d027ea9 P7: c0000005 P8: 000000000004e740 P9: P10:
I wonder whether the way I remove the video component is wrong or there is a bug in Qt 5.13?
How can I investigate more what really happens there?
I also add that I remove video component when it is playing, but stopping before delete does not change anything.@ChrisTof said in Crash when deleteLater() QML Video component in Qt 5.13, but not in Qt.5.12.3:
How can I investigate more what really happens there?
Run through debugger and take a look at stack trace after the crash
-
For some reason I can debug Qt 5.12.3, but when I try to run debug on 5.13 then:
Unable to create a debugging engine.
I have already added 'Debugging Tools for Windows'.
-
Yes, I can confirm the problem persists in qt 5.12.4.
I reported the issue: https://bugreports.qt.io/browse/QTBUG-78207 -
Fix will be introduced in 5.13.2 and 5.14.0 Alpha.
If you do not want to wait, you can make needed changes to the source code and built it yourself.
In file: src/plugins/common/evr/evrcustompresenter.cpp change line 1146 fromif (m_renderState == RenderStopped && m_surface->isActive()) {
to:
if (m_renderState == RenderStopped && m_surface && m_surface->isActive()) {
See issue for more information.