Make all objects created by QtcProcess children of it

Sometimes after creating QtcProcess we move it into a different
thread. In this case we should move all the children, too.
Without parent-child relation all the children will stay in the
old thread.

Change-Id: Ibde44d6153092a155dd2d200a7116a046910dddc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Jarek Kobus
2021-09-02 17:03:49 +02:00
parent a454b3dc23
commit f7aa963a07
6 changed files with 28 additions and 23 deletions

View File

@@ -810,14 +810,14 @@ void LauncherSocket::sendData(const QByteArray &data)
QMetaObject::invokeMethod(this, &LauncherSocket::handleRequests);
}
CallerHandle *LauncherSocket::registerHandle(quintptr token, ProcessMode mode)
CallerHandle *LauncherSocket::registerHandle(QObject *parent, quintptr token, ProcessMode mode)
{
QTC_ASSERT(!isCalledFromLaunchersThread(), return nullptr);
QMutexLocker locker(&m_mutex);
if (m_handles.contains(token))
return nullptr; // TODO: issue a warning
CallerHandle *callerHandle = new CallerHandle(token, mode);
CallerHandle *callerHandle = new CallerHandle(parent, token, mode);
LauncherHandle *launcherHandle = new LauncherHandle(token, mode);
callerHandle->setLauncherHandle(launcherHandle);
launcherHandle->setCallerHandle(callerHandle);