[Interest] Is QObject::deleteLater() thread safe?

Thiago Macieira thiago.macieira at intel.com
Mon Oct 12 16:44:02 CEST 2015


On Monday 12 October 2015 18:51:30 Sze Howe Koh wrote:
> The function body simply calls the following, which is thread safe:
> 
>     QCoreApplication::postEvent(this, new QDeferredDeleteEvent());
> 
> So, it looks like deleteLater() is safe to call from any thread. Are
> there any technical or philosophical reasons not to do that?

It's thread-safe with almost any operation, except one: the actual object's 
deletion, of course.

But we haven't documented it as such. It just happens to be due to the 
implementation.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list