[Interest] Difficulty running Timer from QThread

Björn Schäpers qt-maillist at hazardy.de
Tue Jul 20 20:40:51 CEST 2021


Am 20.07.2021 um 06:19 schrieb Thiago Macieira:
> On Monday, 19 July 2021 11:51:30 PDT Björn Schäpers wrote:
>> Yes, and the Timer was created inside the VLCWorker::initVLC, and said
>> worker was moved, but before initVLC, but initVLC was called in the moved
>> from thread.
> But the QTimer had no parent. From the OP:
>
> rtspStartTimer=new QTimer;
> rtspStartTimer->setSingleShot(true);
> connect(rtspStartTimer, &QTimer::timeout,
>          this, &VLCWorker::rtspStarting);
>
> That means this QTimer wasn't moved and therefore was firing on the thread
> that created the object. Whichever that was.
>
Last response. Yes that's why I advised to parent it, and THEN move to the other 
thread. The Timer would have been moved with its parent.



More information about the Interest mailing list