QObject::deleteLater across a QThread

前端 未结 3 1207
甜味超标
甜味超标 2020-12-11 04:03

I\'m looking for a solution to schedule the deletion of an object across threads. The docs about how deleteLater behave are not entirely clear. Can I call this

3条回答
  •  粉色の甜心
    2020-12-11 04:44

    deleteLater() only means that the object will be deleted after all signal/slots int the current event loop (i.e. ThreadB) have been treated.

    So, if no other slots need ObjectX in ThreadB, it is equivalent to a plain delete.

    Whether you can delete the object or not and how it will be handled in ThreadA is up to your app logic.

    If ObjectX is the main object of the thread, sending the quit() signal to ThreadA is the way to go.

提交回复
热议问题