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. QtFuture::result() deadlocks

QtFuture::result() deadlocks

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 243 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.
  • Ahmed Yarub Hani Al NuaimiA Offline
    Ahmed Yarub Hani Al NuaimiA Offline
    Ahmed Yarub Hani Al Nuaimi
    wrote on last edited by
    #1

    In the image scaling example, adding a downloadFuture.result(); right after downloadFuture = download(urls); deadlocks, while adding a downloadFuture.takeResult(); triggers the isValid()'s assert, although after ignoring the assert it does return the expected value. result() works though from inside another future, just like in the Images::scaled() method. Is that a bug?
    I've struggling for days with a similar scenario where I have a QtFuture::connect() waiting for a QNetworkReply::finished signal but this exhibits the same behavior.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please provide a minimal compilable example that shows that behaviour.

      Also which version of Qt are you using ?

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

      Ahmed Yarub Hani Al NuaimiA 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi,

        Please provide a minimal compilable example that shows that behaviour.

        Also which version of Qt are you using ?

        Ahmed Yarub Hani Al NuaimiA Offline
        Ahmed Yarub Hani Al NuaimiA Offline
        Ahmed Yarub Hani Al Nuaimi
        wrote on last edited by
        #3

        @SGaist said in QtFuture::result() deadlocks:

        Hi,

        Please provide a minimal compilable example that shows that behaviour.

        Also which version of Qt are you using ?

        I tested it on 6.2.0-beta 1 and Windows 11 with the latest Visual C++ 2019 Preview compiler
        As I said before, it was just the image scaling example that comes with Qt, adding a downloadFuture.result() or downloadFuture.takeResult() right after downloadFuture = download(urls);
        Nevertheless, I have created a modified version here: https://github.com/ahmedyarub/imagescaling
        The new line is added here https://github.com/ahmedyarub/imagescaling/blob/main/imagescaling.cpp#L115
        You can test using both result() and takeResult()

        1 Reply Last reply
        0
        • Ahmed Yarub Hani Al NuaimiA Offline
          Ahmed Yarub Hani Al NuaimiA Offline
          Ahmed Yarub Hani Al Nuaimi
          wrote on last edited by
          #4

          Here is a more concise example:
          https://github.com/ahmedyarub/qfutura_deadlock

          1 Reply Last reply
          1
          • Ahmed Yarub Hani Al NuaimiA Offline
            Ahmed Yarub Hani Al NuaimiA Offline
            Ahmed Yarub Hani Al Nuaimi
            wrote on last edited by
            #5

            Opened a bug ticket https://bugreports.qt.io/browse/QTBUG-95321
            So far neither starting in a new thread nor using continuations solves the problem. I want to avoid using QFutureWatcher as it greatly complicates the code especially with the logic I'm trying to implement.

            1 Reply Last reply
            0
            • Ahmed Yarub Hani Al NuaimiA Offline
              Ahmed Yarub Hani Al NuaimiA Offline
              Ahmed Yarub Hani Al Nuaimi
              wrote on last edited by
              #6

              I had very good help from the Qt staff, although I found the solution to be verbose but that would serve for the time being
              https://bugreports.qt.io/browse/QTBUG-95321?focusedCommentId=576678&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-576678

              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 Extensions
              • Unsolved