For what it’s worth, it doesn’t appear that the thread in which the QTimer 
object lived was ever the problem. Even when I first asked the question, 
calling rtspStartTimer->thread() returned the correct thread (or at least the 
same thread as calling this->thread() from a parent class function).

While I have since implemented the suggestions of running the init function in 
response to the QThread started() signal, as well as adding a parent for the 
QTimer, the actual fix was when I discovered that the function that called 
start was *not* running in the thread I thought it was (i.e. some thread other 
than vlcWorkerThread).

From what I can tell, that function being called from the unknown thread was 
the complete cause of the issue.

Thanks all for the help!
---
Israel Brewster
Software Engineer
Alaska Volcano Observatory 
Geophysical Institute - UAF 
2156 Koyukuk Drive 
Fairbanks AK 99775-7320
Work: 907-474-5172
cell:  907-328-9145

> On Jul 20, 2021, at 10:40 AM, Björn Schäpers <qt-maill...@hazardy.de> wrote:
> 
> 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.
> 
> _______________________________________________
> Interest mailing list
> Interest@qt-project.org
> https://lists.qt-project.org/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to