Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

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

    QML and Qt Quick
    3
    10
    580
    Loading More Posts
    • 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
      ChrisTof last edited by 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.

      jsulm 1 Reply Last reply Reply Quote 0
      • C
        ChrisTof last edited by

        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 Reply Quote 3
        • jsulm
          jsulm Lifetime Qt Champion @ChrisTof last edited by

          @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 Reply Quote 2
          • C
            ChrisTof last edited by

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

            jsulm 1 Reply Last reply Reply Quote 0
            • jsulm
              jsulm Lifetime Qt Champion @ChrisTof last edited by

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

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

              1 Reply Last reply Reply Quote 0
              • C
                ChrisTof last edited by ChrisTof

                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 Reply Quote 0
                • C
                  ChrisTof last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • G
                    g3nx last edited by

                    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 Reply Quote 0
                    • G
                      g3nx last edited by g3nx

                      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 Reply Quote 0
                      • C
                        ChrisTof last edited by

                        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 Reply Quote 1
                        • C
                          ChrisTof last edited by

                          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 Reply Quote 3
                          • First post
                            Last post