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. QFutureWatcher's signal finished does not get emitted.
QtWS25 Last Chance

QFutureWatcher's signal finished does not get emitted.

Scheduled Pinned Locked Moved Unsolved General and Desktop
qfuturewatchersignals&slotsfinished
16 Posts 5 Posters 6.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.
  • S SGaist
    16 Dec 2017, 21:39

    Hi,

    What about calling signalObj->deleteLater() in place of delete?

    0 Offline
    0 Offline
    0xedd1e
    wrote on 16 Dec 2017, 22:03 last edited by
    #7

    @SGaist
    I've just tried that and slotFinished() is still not called.

    M 1 Reply Last reply 16 Dec 2017, 22:34
    0
    • 0 0xedd1e
      16 Dec 2017, 22:03

      @SGaist
      I've just tried that and slotFinished() is still not called.

      M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 16 Dec 2017, 22:34 last edited by
      #8

      @0xedd1e
      Hi
      Are you running ScriptInstance in another thread? (movetothread style)
      Have you checked you can emit a signal and have a slot called in the class ?
      ( or the actual worker thread if that is the case)

      I tried Wielands code in main thread and it worked so i wondering
      if its something with emitting signals from your actual code.
      (clearly it is but i mean in general)

      So forget about async/QFutureWatcher for a moment and simply emit a signal to a slot
      on same level/class/interclass as the QFutureWatcher is running.

      Sorry if you already validated other signals do work. It was just a thought.

      0 1 Reply Last reply 16 Dec 2017, 22:57
      2
      • M mrjj
        16 Dec 2017, 22:34

        @0xedd1e
        Hi
        Are you running ScriptInstance in another thread? (movetothread style)
        Have you checked you can emit a signal and have a slot called in the class ?
        ( or the actual worker thread if that is the case)

        I tried Wielands code in main thread and it worked so i wondering
        if its something with emitting signals from your actual code.
        (clearly it is but i mean in general)

        So forget about async/QFutureWatcher for a moment and simply emit a signal to a slot
        on same level/class/interclass as the QFutureWatcher is running.

        Sorry if you already validated other signals do work. It was just a thought.

        0 Offline
        0 Offline
        0xedd1e
        wrote on 16 Dec 2017, 22:57 last edited by
        #9

        @mrjj
        I've now done the following;

        1. Added a new signal, signalDebug(), to ScriptInstance class.
        2. Connected signalDebug() to slot slotFinished() in the constructor for ScriptInstance class.
        3. In ScriptInstance::scriptExecutionThread() I emitted the signalDebug() signal.

        Result: slotFinished() is called just fine.

        FYI: I'm also back to using QtConcurrent mechanisms.

        M 1 Reply Last reply 17 Dec 2017, 10:36
        1
        • 0 0xedd1e
          16 Dec 2017, 22:57

          @mrjj
          I've now done the following;

          1. Added a new signal, signalDebug(), to ScriptInstance class.
          2. Connected signalDebug() to slot slotFinished() in the constructor for ScriptInstance class.
          3. In ScriptInstance::scriptExecutionThread() I emitted the signalDebug() signal.

          Result: slotFinished() is called just fine.

          FYI: I'm also back to using QtConcurrent mechanisms.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 17 Dec 2017, 10:36 last edited by mrjj
          #10

          @0xedd1e
          Ok, so signals seems to work.
          I was wondering if you needed to specify connection type
          but if some signals work, all should.

          but just for test
          connect(&_scriptWatcher, &QFutureWatcher<void>::finished, this, &ScriptInstance::slotFinished, Qt::QueuedConnection);

          Else Im a bit out of idea as all seem ok.

          Update
          I ran your code and slotFinished was called ?
          Can you try it
          https://www.dropbox.com/s/rhdk6xxk323ziqh/test_thread.zip?dl=0

          alt text

          0 1 Reply Last reply 17 Dec 2017, 11:24
          1
          • M mrjj
            17 Dec 2017, 10:36

            @0xedd1e
            Ok, so signals seems to work.
            I was wondering if you needed to specify connection type
            but if some signals work, all should.

            but just for test
            connect(&_scriptWatcher, &QFutureWatcher<void>::finished, this, &ScriptInstance::slotFinished, Qt::QueuedConnection);

            Else Im a bit out of idea as all seem ok.

            Update
            I ran your code and slotFinished was called ?
            Can you try it
            https://www.dropbox.com/s/rhdk6xxk323ziqh/test_thread.zip?dl=0

            alt text

            0 Offline
            0 Offline
            0xedd1e
            wrote on 17 Dec 2017, 11:24 last edited by
            #11

            @mrjj
            Once I discovered the issue I experimented with different type of connections, but no change in behavior.

            The project you provided works just fine, so I guess that rules out that there is no issue(s) related to my setup at least.

            The ScriptEngine in my case is a singleton, but I don't see why that should matter in this case since all other signals/slots seems to work just fine.

            M 1 Reply Last reply 17 Dec 2017, 11:36
            0
            • 0 0xedd1e
              17 Dec 2017, 11:24

              @mrjj
              Once I discovered the issue I experimented with different type of connections, but no change in behavior.

              The project you provided works just fine, so I guess that rules out that there is no issue(s) related to my setup at least.

              The ScriptEngine in my case is a singleton, but I don't see why that should matter in this case since all other signals/slots seems to work just fine.

              M Offline
              M Offline
              mrjj
              Lifetime Qt Champion
              wrote on 17 Dec 2017, 11:36 last edited by
              #12

              @0xedd1e
              Ok. super. Yes it means nothing wrong inside Qt/the setup.

              • ScriptEngine in my case is a singleton

              meaning its static ?

              But I agree if other signals can get be emitted (from same nesting level) then
              it seems unlikely its that.

              0 1 Reply Last reply 17 Dec 2017, 14:25
              0
              • M mrjj
                17 Dec 2017, 11:36

                @0xedd1e
                Ok. super. Yes it means nothing wrong inside Qt/the setup.

                • ScriptEngine in my case is a singleton

                meaning its static ?

                But I agree if other signals can get be emitted (from same nesting level) then
                it seems unlikely its that.

                0 Offline
                0 Offline
                0xedd1e
                wrote on 17 Dec 2017, 14:25 last edited by
                #13

                @mrjj
                Correct, it is static.

                I'm really out of ideas, so I guess I have to go back to earlier changesets within my project and see if I can pinpoint the exact change that caused this behavior. However, the code connected to the script engine and script instance hasn't changed for quite a while though, so I'll try to back the project to an earlier changeset and see if there are changes elsewhere that causes this. I registered a bug in my own ticket system when I discovered this issue but marked it for check-later-when-qt-upgrades since it worked fine in QT 5.4 and earlier.

                Thanks again for all the feedback and I'll report back during the upcoming holiday.

                0 1 Reply Last reply 17 Dec 2017, 16:23
                0
                • 0 0xedd1e
                  17 Dec 2017, 14:25

                  @mrjj
                  Correct, it is static.

                  I'm really out of ideas, so I guess I have to go back to earlier changesets within my project and see if I can pinpoint the exact change that caused this behavior. However, the code connected to the script engine and script instance hasn't changed for quite a while though, so I'll try to back the project to an earlier changeset and see if there are changes elsewhere that causes this. I registered a bug in my own ticket system when I discovered this issue but marked it for check-later-when-qt-upgrades since it worked fine in QT 5.4 and earlier.

                  Thanks again for all the feedback and I'll report back during the upcoming holiday.

                  0 Offline
                  0 Offline
                  0xedd1e
                  wrote on 17 Dec 2017, 16:23 last edited by
                  #14

                  @0xedd1e said in QFutureWatcher's signal finished does not get emitted.:

                  @mrjj
                  Correct, it is static.

                  I'm really out of ideas, so I guess I have to go back to earlier changesets within my project and see if I can pinpoint the exact change that caused this behavior. However, the code connected to the script engine and script instance hasn't changed for quite a while though, so I'll try to back the project to an earlier changeset and see if there are changes elsewhere that causes this. I registered a bug in my own ticket system when I discovered this issue but marked it for check-later-when-qt-upgrades since it worked fine in QT 5.4 and earlier.

                  Thanks again for all the feedback and I'll report back during the upcoming holiday.

                  FYI;
                  I've now gone back and tested previous versions of the project but can't seem to get it working in any of the earlier versions now using QT 5.10. So I guess something has changed in QT, but I can't figure out what though and to my knowledge I follow the recommendations according to the documentation of QT.

                  Worth trying going back to using earlier versions of QT?

                  M 1 Reply Last reply 17 Dec 2017, 16:30
                  0
                  • 0 0xedd1e
                    17 Dec 2017, 16:23

                    @0xedd1e said in QFutureWatcher's signal finished does not get emitted.:

                    @mrjj
                    Correct, it is static.

                    I'm really out of ideas, so I guess I have to go back to earlier changesets within my project and see if I can pinpoint the exact change that caused this behavior. However, the code connected to the script engine and script instance hasn't changed for quite a while though, so I'll try to back the project to an earlier changeset and see if there are changes elsewhere that causes this. I registered a bug in my own ticket system when I discovered this issue but marked it for check-later-when-qt-upgrades since it worked fine in QT 5.4 and earlier.

                    Thanks again for all the feedback and I'll report back during the upcoming holiday.

                    FYI;
                    I've now gone back and tested previous versions of the project but can't seem to get it working in any of the earlier versions now using QT 5.10. So I guess something has changed in QT, but I can't figure out what though and to my knowledge I follow the recommendations according to the documentation of QT.

                    Worth trying going back to using earlier versions of QT?

                    M Offline
                    M Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on 17 Dec 2017, 16:30 last edited by
                    #15

                    @0xedd1e
                    Hi I also looked at the release notes to see
                    if something with Future/Concurrent was changed but nothing popped up.

                    • Worth trying going back to using earlier versions of QT?

                    Well for test. it would be a good test if exact same code just works in say 5.6
                    and not in 5.10. But being stucked at 5.4 would be not so optimal.

                    A note about the static.
                    Just to be sure. the class that expects the Finished signal is a static member of some other class?
                    As far as i can recall, you cant compile if you try to connect to a static class slot so im inclided to
                    say that is not the issue.

                    Since your mini sample works. There must be some difference in the real code. But i cant
                    think of more to check.

                    1 Reply Last reply
                    0
                    • L Offline
                      L Offline
                      leochan2009
                      wrote on 26 Jan 2021, 02:35 last edited by
                      #16

                      same issue i have came across; see my post:
                      https://forum.qt.io/topic/122640/qvideoprobe-stop-working-when-processing-time-is-long/11

                      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