Important: Please read the Qt Code of Conduct -

runtime error and QFuture

  • Hello guys. I am still learning Qt C++ and I have a lot of code, so I will try and explain my problem in point form as best as I can. Please bear with me.

    • I have two objects of a class.

    • From my MainWindow.cpp i connect signals and slots to these two objects functions, where data is processed and results are emitted back to my main MainWindow.

    • Two QFutures are created using each of those class objects. They are ran by using QFuture<void> futureEg1 = QtConcurrent::run( &object, &ClassName::function, args...)

    • All is good till this point, I am able to process my data and retrieve it in my main thread for both objects.

    • At the moment, in my main thread's slot that receives the data, I am only qDebugging the results. No modifications or other access, as I'm afraid of data being unsynchronised or something?

    Is there be a problem when two signals emit the same slot at the same time in my main thread, as I have encountered a runtime error.

    Thanks and if you need me to clarify or show the relevant parts of the code, anything I will most definitely do so. Your help is of utmost appreciation!

  • @scottnat said in runtime error and QFuture:

    Is there be a problem when two signals emit the same slot at the same time in my main thread

    No, unless you force Qt::DirectConnection

    as I have encountered a runtime error

    Post stack trace please

  • This post is deleted!

  • @VRonin
    Hi, thanks VRonin for the reply. Turns out the problem was to do with the library of FFTW that I used.

    I used separate threads to run functions from that library, which apparently are not thread safe. However, even with mutex locks they still wouldn't work. Back to the drawing board.


Log in to reply