[Pyqt_error] Qobject::killtimer:timers cannot to stopped from another thread

Source: Internet
Author: User

Qobject::killtimer:timers cannot to stopped from another thread

This error occurs because some of the operations of the main thread object in the secondary thread are caused by
You can modify this
If the secondary thread needs to update the main thread object state, it needs to send a message, and the main thread object receives the processing without directly manipulating the thread

QT Timer is very good, just pay attention to cross threading issues

Considerations for using Timers:
1. QT Timer thread-related usage considerations:
1> can not boast thread start timer and stop timer
1> cannot boast a thread that initiates a timer-associated object, but releases (destructors) the object associated with the timer on another thread (the equivalent of 1> cannot stop the timer on other threads).

Qwarning ("Qobject::killtimers:timers cannot is stopped from another thread");

That is, timer-related logic and objects can only be used in one thread.
Because the QT timer has an internal data structure to correlate the timer-related logic.

Otherwise: The thread that starts the timer cannot delete the timer, and the timer associated with the object no longer exists, then the next timer event will crash.

Detailed principle is visible
The relationship between Qthread and Qobject

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.