Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QtConcurrent mapped crashes
Forum Updated to NodeBB v4.3 + New Features

QtConcurrent mapped crashes

Scheduled Pinned Locked Moved Unsolved General and Desktop
concurrent
16 Posts 4 Posters 1.7k Views 1 Watching
  • 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.
  • A akshaybabloo
    7 Jan 2022, 07:33

    @jsulm I got an popup window that says - Stopped in thread 13 by: Exception at 0x7ff97c36bdda, code: 0xc0000005: read access violation at: 0x1b39f8c42ba, flags=0x0 (first chance).

    And the console shows:

    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(10) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(11) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(12) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(13) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(14) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(15) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(16) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(17) tid(14090) 80070490 Element not found.
    onecore\com\combase\winrt\error\restrictederror.cpp(965)\combase.dll!00007FFA219D387F: (caller: 00007FFA218EBF94) LogHr(18) tid(14090) 80070490 Element not found.
    
    J Offline
    J Offline
    jsulm
    Lifetime Qt Champion
    wrote on 7 Jan 2022, 07:35 last edited by
    #4

    @akshaybabloo Please show the stack trace.
    And what about my other suggestion?

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

    A 1 Reply Last reply 7 Jan 2022, 07:41
    0
    • J jsulm
      7 Jan 2022, 07:35

      @akshaybabloo Please show the stack trace.
      And what about my other suggestion?

      A Offline
      A Offline
      akshaybabloo
      wrote on 7 Jan 2022, 07:41 last edited by
      #5

      @jsulm I did check if the image is null or not.

      Screenshot 2022-01-07 204054.png

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on 7 Jan 2022, 17:44 last edited by
        #6

        Your stacktrace shows a VideoSequencer class or function but your code does not.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        A 1 Reply Last reply 7 Jan 2022, 19:37
        0
        • C Christian Ehrlicher
          7 Jan 2022, 17:44

          Your stacktrace shows a VideoSequencer class or function but your code does not.

          A Offline
          A Offline
          akshaybabloo
          wrote on 7 Jan 2022, 19:37 last edited by
          #7

          @Christian-Ehrlicher Sorry. What does that mean?

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 7 Jan 2022, 19:44 last edited by
            #8

            Your code and your stack imo trace to not match. Compile your app in debug mode and show the back trace again. There must be line numbers for your code in the stack trace, not just for Qt.

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            A 3 Replies Last reply 7 Jan 2022, 20:09
            0
            • C Christian Ehrlicher
              7 Jan 2022, 19:44

              Your code and your stack imo trace to not match. Compile your app in debug mode and show the back trace again. There must be line numbers for your code in the stack trace, not just for Qt.

              A Offline
              A Offline
              akshaybabloo
              wrote on 7 Jan 2022, 20:09 last edited by
              #9

              @Christian-Ehrlicher When I try to do that, I get - This does not seem to be a "Debug" build. Setting breakpoints by file name and line number may fail. and I am in a Debug profile

              1 Reply Last reply
              0
              • C Christian Ehrlicher
                7 Jan 2022, 19:44

                Your code and your stack imo trace to not match. Compile your app in debug mode and show the back trace again. There must be line numbers for your code in the stack trace, not just for Qt.

                A Offline
                A Offline
                akshaybabloo
                wrote on 7 Jan 2022, 20:27 last edited by
                #10

                @Christian-Ehrlicher I tried to change the build type to Debug and now I get error in build settings as (screenshot):

                Screenshot 2022-01-08 092552.png

                Debug initial parameters are:

                -GNinja
                -DCMAKE_BUILD_TYPE:STRING=Debug
                -DCMAKE_PROJECT_INCLUDE_BEFORE:PATH=%{IDE:ResourcePath}/package-manager/auto-setup.cmake
                -DQT_QMAKE_EXECUTABLE:STRING=%{Qt:qmakeExecutable}
                -DCMAKE_PREFIX_PATH:STRING=%{Qt:QT_INSTALL_PREFIX}
                -DCMAKE_C_COMPILER:STRING=%{Compiler:Executable:C}
                -DCMAKE_CXX_COMPILER:STRING=%{Compiler:Executable:Cxx}
                
                1 Reply Last reply
                0
                • C Christian Ehrlicher
                  7 Jan 2022, 19:44

                  Your code and your stack imo trace to not match. Compile your app in debug mode and show the back trace again. There must be line numbers for your code in the stack trace, not just for Qt.

                  A Offline
                  A Offline
                  akshaybabloo
                  wrote on 7 Jan 2022, 21:09 last edited by
                  #11

                  @Christian-Ehrlicher Never mind. The issue was with Conan. I got it working now.

                  And here is the screenshot:

                  Screenshot 2022-01-08 100857.png

                  Also added a small change:

                  QImage ImageFormatter::scaled(const QImage &image) {
                      if (image.isNull()){
                          qDebug()<<image;
                          return image;
                      }
                      return image.scaled(100,100);
                  }
                  
                  1 Reply Last reply
                  0
                  • C Offline
                    C Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on 7 Jan 2022, 21:12 last edited by
                    #12

                    Ok, better now.
                    And you're sure the QImage is not touched from outside in another thread? Please take a look what the other threads are doing while it crashes. Is imageData still valid during the lifetime of QtConcurrent::mapped()?

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    A 1 Reply Last reply 7 Jan 2022, 21:32
                    0
                    • C Christian Ehrlicher
                      7 Jan 2022, 21:12

                      Ok, better now.
                      And you're sure the QImage is not touched from outside in another thread? Please take a look what the other threads are doing while it crashes. Is imageData still valid during the lifetime of QtConcurrent::mapped()?

                      A Offline
                      A Offline
                      akshaybabloo
                      wrote on 7 Jan 2022, 21:32 last edited by
                      #13

                      @Christian-Ehrlicher As far as I know, no. I am doing this only after creating the list of ImageData. The getters has [[nodiscard]] attribute. I am also using OpenCV to read in the video files and converting them into frames, but this is flushed after getting the frames.

                      The code can be found at https://github.com/akshaybabloo/VideoSequencer

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on 8 Jan 2022, 09:30 last edited by
                        #14

                        data->appendFrame(QImage(frame.data, frame.cols, frame.rows, frame.step, QImage::Format_RGB888));

                        Default problem not reading the QImage documentation...

                        The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        A 1 Reply Last reply 8 Jan 2022, 20:07
                        3
                        • C Christian Ehrlicher
                          8 Jan 2022, 09:30

                          data->appendFrame(QImage(frame.data, frame.cols, frame.rows, frame.step, QImage::Format_RGB888));

                          Default problem not reading the QImage documentation...

                          The buffer must remain valid throughout the life of the QImage and all copies that have not been modified or otherwise detached from the original buffer. The image does not delete the buffer at destruction. You can provide a function pointer cleanupFunction along with an extra pointer cleanupInfo that will be called when the last copy is destroyed.

                          A Offline
                          A Offline
                          akshaybabloo
                          wrote on 8 Jan 2022, 20:07 last edited by
                          #15

                          @Christian-Ehrlicher I have no idea what that means 😅

                          1 Reply Last reply
                          0
                          • S Offline
                            S Offline
                            SGaist
                            Lifetime Qt Champion
                            wrote on 8 Jan 2022, 20:21 last edited by
                            #16

                            Hi,

                            You create a QImage out of an OpenCV Mat object. The constructor you use for that explicitly does not copy the data from the Mat object. This is what the warning is all about. It is your job to ensure that the Mat object lifetime is longer than the one of of your QImage.

                            Or you should explicitly trigger a copy of the QImage object when adding it to your array.

                            What happens is that when you do your concurrent call is that Mat object that used went out of scope and thus the QImage internal structure is now pointing to invalid data.

                            Interested in AI ? www.idiap.ch
                            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            3

                            13/16

                            7 Jan 2022, 21:32

                            • Login

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