Qt World Summit: Register Today!

[SOLVED] timers cannot be stopped from a different thread

  • I have some multi-threaded code, written in the moveToThread mode--I also use QRunnables. When I exit my program, I get a message--on both linux and Windows--
    QObject::~QObject: Timers cannot be stopped from another thread

    I don't use any timers in my program. None. The string "timer" does not occur anywhere in my own code.

    Is it being used by the API somewhere? How can I stop this from happening?

  • Hi and welcome to devnet,

    you can try executing you application with debugger and verify where and how timers are started stopped.
    Could you post some parts of code?

  • Moderators

    Hi @jhowland,

    Each QObject has a built-in timer. Qt might use it for internal purposes

    QObject::~QObject: Timers...

    The part before ": Timers" shows the function which produced this message. In your case, it is a QObject destructor. This suggests that an object is getting deleted in the wrong thread.

  • @JKSH Thanks--this helped me solve the problem. In a GUI thread, I was using exit()--when I should have just used emit finished()

Log in to reply