qt5: destroy finished thread in 'QThread::start()'

A 'QThread' can be reused when its execution is finished by calling
'QThread::start()' again. Before this commit, this created a new Genode
thread, but did not destroy a previously finished Genode thread first.

Fixes #2928
This commit is contained in:
Christian Prochaska 2018-08-02 14:37:58 +02:00 committed by Norman Feske
parent 007a977cb0
commit 0d7dec0436

View File

@ -659,6 +659,19 @@ void QThread::start(Priority priority)
if (d->running)
return;
#ifdef Q_OS_GENODE
if (d->finished) {
/**
* Thread is to be restarted.
*
* Since a new Genode thread is going to be created below, the old one
* needs to be destroyed first.
*/
delete d->genode_thread;
d->genode_thread = 0;
}
#endif
d->running = true;
d->finished = false;
d->returnCode = 0;