Nominate our 2022 Qt Champions!

Handling exceptions thrown from handlers of background threads

  • Hi all.

    I know that you need to reimplement the QApplication::notify() method to properly catch exceptions thrown from the main thread's event handlers.
    But what about other threads? Say, I have an object with a slot, and this object lives in a QThread (with default run() method, which just calls exec()), i.e. the thread affinity of this object is the background QThread. So, where should I catch exceptions thrown from this object's slot?

    IOW, how do I reimplement the notify() method of a background thread?

Log in to reply