Commit Graph

6 Commits

Author SHA1 Message Date
Jarek Kobus
f25300cadf Fix a possible crash in process launcher
It may apparently happen that when calling QProcess::start()
we may receive a synchronous signal QProcess::errorOccurred()
from the process we are trying to start. In this case
the handler of the error signal might have removed the
process from m_processes hash, which invalidated the
"Process *& process" reference inside
LauncherSocketHandler::handleStartPacket(). So, using
process reference after calling start() may be dangerous.

Refactor ProcessStartHandler so that it stores the pointer
to the process it handles. The pointer to the handler
should still be valid after calling start(), since
the process itself is being deleted with a delay.

Make ProcessStartHandler a member of ProcessHelper. In this
way it's being reused in QProcessImpl and ProcessLauncher.

Fixes: QTCREATORBUG-26726
Change-Id: I8e3f39953035d76c83bbbb13bd78e3042ba2a14e
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2021-12-21 12:47:05 +00:00
Jarek Kobus
f7aa963a07 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>
2021-09-03 10:56:26 +00:00
Jarek Kobus
b80624611b Reuse ProcessHelper in process launcher
Handle lowPriority and unixTerminalDisabled inside
process launcher.

Change-Id: I7a8998e303da0e79186c1201fc6e1a76edb4e1b3
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-08-09 14:38:43 +00:00
Jarek Kobus
4e06d3ac74 Handle setNativeArguments inside process launcher
Change-Id: I4b4db2e5cf6b3ad4d8a39614573564145f125520
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 13:31:24 +00:00
Jarek Kobus
8fa1a1f587 Handle belowNormalPriority inside process launcher on Windows
Remove setCreateProcessArgumentModifier() from the ProcessInterface
API and replace it with belowNormalPriority flag.

Change-Id: I6bcb92e56c3a68af7fa3e3a1c8b8eb13e3a2e5a7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 13:23:37 +00:00
Jarek Kobus
25f585227f Refactor openMode/keepWriteChannelOpen/closeWriteChannel
Change-Id: I4090533875ce1da864b6f8554ce59dbc1392a142
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 07:51:26 +00:00