Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Crash when deleteLater() QML Video component in Qt 5.12.4-5.13.1, but not in Qt.5.12.3
QtWS25 Last Chance

Crash when deleteLater() QML Video component in Qt 5.12.4-5.13.1, but not in Qt.5.12.3

Scheduled Pinned Locked Moved Solved QML and Qt Quick
10 Posts 3 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    ChrisTof
    wrote on last edited by ChrisTof
    #1

    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.dll

    Faulting 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.

    jsulmJ 1 Reply Last reply
    0
    • C Offline
      C Offline
      ChrisTof
      wrote on last edited by
      #10

      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 from

      if (m_renderState == RenderStopped && m_surface->isActive()) {
      

      to:

      if (m_renderState == RenderStopped && m_surface && m_surface->isActive()) {
      

      See issue for more information.

      1 Reply Last reply
      3
      • C ChrisTof

        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.dll

        Faulting 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.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @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

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        2
        • C Offline
          C Offline
          ChrisTof
          wrote on last edited by
          #3

          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'.

          jsulmJ 1 Reply Last reply
          0
          • C ChrisTof

            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'.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @christof And the correct debugger is set in the Kit?

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • C Offline
              C Offline
              ChrisTof
              wrote on last edited by ChrisTof
              #5

              It wasn't. Got the debugger working.
              0_1565267357470_bugQt5_13.PNG
              The image was taken during debugging 5.13.0.
              The same code executed under 5.12.3 runs without any error.

              1 Reply Last reply
              0
              • C Offline
                C Offline
                ChrisTof
                wrote on last edited by
                #6

                In Qt 5.13.1 the error still persists. Any ideas why that happens?

                1 Reply Last reply
                0
                • G Offline
                  G Offline
                  g3nx
                  wrote on last edited by
                  #7

                  I'm facing a similar issue but with pure QML code. The application crashes just after removing the QML Component containing the video item. Problem persists both in qt 5.12.4 and qt 5.13.1

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    g3nx
                    wrote on last edited by g3nx
                    #8

                    Furthermore i can confirm that also in my case, the code works properly with qt 5.12.3. It does seem a regression introduced from qt 5.12.4.
                    @ChrisTof could you confirm that the problem persist in qt 5.12.4 also in your case?

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      ChrisTof
                      wrote on last edited by
                      #9

                      Yes, I can confirm the problem persists in qt 5.12.4.
                      I reported the issue: https://bugreports.qt.io/browse/QTBUG-78207

                      1 Reply Last reply
                      1
                      • C Offline
                        C Offline
                        ChrisTof
                        wrote on last edited by
                        #10

                        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 from

                        if (m_renderState == RenderStopped && m_surface->isActive()) {
                        

                        to:

                        if (m_renderState == RenderStopped && m_surface && m_surface->isActive()) {
                        

                        See issue for more information.

                        1 Reply Last reply
                        3

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved