Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. App hangs in QPixmap::fromImage
Qt 6.12 LTS is out! See what's new in the release blog

App hangs in QPixmap::fromImage

Scheduled Pinned Locked Moved Unsolved General and Desktop
25 Posts 6 Posters 17.4k Views 2 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.
  • Christian EhrlicherC Offline
    Christian EhrlicherC Offline
    Christian Ehrlicher
    Lifetime Qt Champion
    wrote on last edited by
    #14

    Again: it hangs on a mutex lock - nothing to do with the data. Take a look if this mutex is locked in another thread...

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

    M 1 Reply Last reply
    0
    • Christian EhrlicherC Christian Ehrlicher

      Again: it hangs on a mutex lock - nothing to do with the data. Take a look if this mutex is locked in another thread...

      M Offline
      M Offline
      mpouchol
      wrote on last edited by
      #15

      @Christian-Ehrlicher the mutex is owned by Qt code inside QPixmap::fromImage
      I don't use this function from other threads so I don't see what I did that caused it to stay locked.

      Christian EhrlicherC 1 Reply Last reply
      0
      • M mpouchol

        @Christian-Ehrlicher the mutex is owned by Qt code inside QPixmap::fromImage
        I don't use this function from other threads so I don't see what I did that caused it to stay locked.

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #16

        @mpouchol said in App hangs in QPixmap::fromImage:

        I don't use this function from other threads so I don't see what I did that caused it to stay locked.

        I'm giving up... looks like it's too hard to look into the other threads while it is hanging to see if another thread is also using this mutex. So try to figure it out by your own.

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

        M 1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          @mpouchol said in App hangs in QPixmap::fromImage:

          I don't use this function from other threads so I don't see what I did that caused it to stay locked.

          I'm giving up... looks like it's too hard to look into the other threads while it is hanging to see if another thread is also using this mutex. So try to figure it out by your own.

          M Offline
          M Offline
          mpouchol
          wrote on last edited by
          #17

          @Christian-Ehrlicher said in App hangs in QPixmap::fromImage:

          I'm giving up... looks like it's too hard to look into the other threads

          I did that and that's not the case. Thanks for your help anyway.

          1 Reply Last reply
          0
          • Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #18

            Ok, taking a deeper look into convert_generic() the qimage is converted with more than one thread. One of these subthreads hangs maybe due to a broken QImage. Look into your other threads to see which one is somewhere hanging inside convertSegment()

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

            1 Reply Last reply
            1
            • M Offline
              M Offline
              mpouchol
              wrote on last edited by
              #19

              I also had a look at the code inside convert_generic(). When the main thread is frozen I don't see other threads hanging in convertSegment which make me think that maybe one of the convertSegment threads has died silently and is not releasing the semaphore in convert_generic because I don't see visual studio raising exceptions in other threads.

              1 Reply Last reply
              0
              • Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #20

                If you compile Qt by your own build a big try/catch block around convert_segment and simply catch all exceptions to see if there is one.
                You can also create a helper thread which writes out the current qimage after a certain period of time when it was not canceled in between so you can inspect the qimage.

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

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #21

                  Ah, see https://bugreports.qt.io/browse/QTBUG-90629 and https://bugreports.qt.io/browse/QTBUG-92188 even I don't see how this should affect windows.

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

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    mpouchol
                    wrote on last edited by
                    #22

                    @Christian-Ehrlicher said in App hangs in QPixmap::fromImage:

                    https://bugreports.qt.io/browse/QTBUG-90629

                    Indeed when looking at the stack trace it looks very similar to my case, almost the same function calls except for the low level semaphore things on linux.

                    I think I may have to rebuild Qt and try your suggestion to wrap convert_segment around a try/catch block to have more detail.

                    G 1 Reply Last reply
                    0
                    • M mpouchol

                      @Christian-Ehrlicher said in App hangs in QPixmap::fromImage:

                      https://bugreports.qt.io/browse/QTBUG-90629

                      Indeed when looking at the stack trace it looks very similar to my case, almost the same function calls except for the low level semaphore things on linux.

                      I think I may have to rebuild Qt and try your suggestion to wrap convert_segment around a try/catch block to have more detail.

                      G Offline
                      G Offline
                      Gerald Lodron
                      wrote on last edited by
                      #23

                      @mpouchol
                      I updated my (working) software from 5.12.11 to 5.15.8 and have exactly the same problem, now the QPixmap::fromImage hangs. I did not debugged into qt but its defenitely in main thread and its my only and first call of it. It happens every time in my case, the image is a Format_Grayscale8 too

                      is there a solution for it?

                      G 1 Reply Last reply
                      0
                      • G Gerald Lodron

                        @mpouchol
                        I updated my (working) software from 5.12.11 to 5.15.8 and have exactly the same problem, now the QPixmap::fromImage hangs. I did not debugged into qt but its defenitely in main thread and its my only and first call of it. It happens every time in my case, the image is a Format_Grayscale8 too

                        is there a solution for it?

                        G Offline
                        G Offline
                        Gerald Lodron
                        wrote on last edited by
                        #24

                        it really seems to have something to do with Format_Grayscale8, Format_RGB888 and QImage::Format_Mono works...

                        1 Reply Last reply
                        0
                        • X Offline
                          X Offline
                          X-Hawk
                          wrote on last edited by
                          #25

                          There must be some bug in QThreadPool cause QPixmap hangs.
                          Set setExpiryTimeout to -1 may help, just a workaround, not bug fix.

                          QThreadPool *threadPool = QThreadPool::globalInstance();
                          if (threadPool) {
                              threadPool->setExpiryTimeout(-1);
                          }
                          
                          1 Reply Last reply
                          0

                          • Login

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