[Interest] QMetaObject::invokeMethod thread safety
mwoehlke.floss at gmail.com
Fri May 17 20:48:41 CEST 2019
On 17/05/2019 13.47, Thiago Macieira wrote:
> On Friday, 17 May 2019 10:25:15 PDT Matthew Woehlke wrote:
>> IOW, I have some shared object owner by Thread 1 which is eventually
>> deleted. In Thread 2, I want to queue a call to a slot on that object.
> Thread-safety does not apply while the object in question is being destroyed.
> So, no, you can't race against the object's destruction. Ensure that the
> destructor has not begun running when you post an event or make a metacall or
> basically anything else.
Okay, thanks for confirming!
I will continue to use a shared pointer to the object in question; that
way the invokeMethod caller/thread owns a reference to the object
ensuring it can't be destroyed until invokeMethod completes.
More information about the Interest