I am looking for a solution for scheduling object deletion by thread. The documents on how they deleteLaterbehave are not entirely clear. Is it possible to call this function in a thread that does not own the object?
For example, Object X belongs to Thread A, and in Thread B I would like to delete Object X. Since the object may be inside the event processing at the moment (in Thread A), I cannot safely delete it until it returns to the message loop. If I call deleteLaterfrom Thread B, however the docs seem to indicate that it will delete as soon as Thread B returns to the message loop.
I am currently taking the approach to the signal emitted in stream A, which is attached to the slot that triggers deleteLater. I am wondering if there is an easier way to do this - if really, I can just call deleteLaterfrom any thread.
source
share