Dear all, I have a "worker" QObject of class Worker, that I push to a separate QThread "workerThread" using moveToThread from my main thread.
The doc says the moved object should have no parent. Which means the Worker will not be deleted when my main app QObject closes. For cleaniness of the code, I would like to avoid storing a pointer to the object for deletion, and would prefer to find a way for the Worker to be always cleanly deleted. Is it safe and correct to connect QThread::quit() and QThread::terminated() to Worker::deleteLater() ? I would say no, as signal/slot mechanism will try to run deleteLater() in the workerThread, which is not running anymore, so object deletion will never happen. May I connect to objects that are not living in the same thread (workerThread lives in the main thread and worker lives in workerThread) using a forced DirectConnection ? Will this work? Or, put another way, how may I move the worker in workerThread, and forget about the worker pointer, the object being automatically deleted when workerThread is finished or deleted? Thanks in advance for the power user advices! Etienne
_______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
