summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-02 09:53:12 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-02 23:58:58 +0200
commit013b6cf0f15b2e770a0e51be745e4484e89ea926 (patch)
tree412932453292b53b59396a36cc2d2535e4ef2fde /src/corelib/io
parentf478905068647495da04dcdb193457f2199835d6 (diff)
QProcessPrivate: Use member initialization
Change-Id: I9fb8120a68daaa41c153010a52f7a3e99087153b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qprocess.cpp21
-rw-r--r--src/corelib/io/qprocess_p.h36
2 files changed, 18 insertions, 39 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 8b35836584..a7be5f2708 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -828,27 +828,6 @@ QProcessPrivate::QProcessPrivate()
{
readBufferChunkSize = QRINGBUFFER_CHUNKSIZE;
writeBufferChunkSize = QRINGBUFFER_CHUNKSIZE;
- processChannelMode = QProcess::SeparateChannels;
- inputChannelMode = QProcess::ManagedInputChannel;
- processError = QProcess::UnknownError;
- processState = QProcess::NotRunning;
- pid = 0;
- sequenceNumber = 0;
- exitCode = 0;
- exitStatus = QProcess::NormalExit;
- startupSocketNotifier = nullptr;
- deathNotifier = nullptr;
- childStartedPipe[0] = INVALID_Q_PIPE;
- childStartedPipe[1] = INVALID_Q_PIPE;
- forkfd = -1;
- crashed = false;
- dying = false;
- emittedReadyRead = false;
- emittedBytesWritten = false;
-#ifdef Q_OS_WIN
- stdinWriteTrigger = 0;
- processFinishedNotifier = 0;
-#endif // Q_OS_WIN
}
/*!
diff --git a/src/corelib/io/qprocess_p.h b/src/corelib/io/qprocess_p.h
index 7cb70cc95c..dec2ea0703 100644
--- a/src/corelib/io/qprocess_p.h
+++ b/src/corelib/io/qprocess_p.h
@@ -297,17 +297,17 @@ public:
bool _q_startupNotification();
bool _q_processDied();
- QProcess::ProcessChannelMode processChannelMode;
- QProcess::InputChannelMode inputChannelMode;
- QProcess::ProcessError processError;
- QProcess::ProcessState processState;
+ QProcess::ProcessChannelMode processChannelMode = QProcess::SeparateChannels;
+ QProcess::InputChannelMode inputChannelMode = QProcess::ManagedInputChannel;
+ QProcess::ProcessError processError = QProcess::UnknownError;
+ QProcess::ProcessState processState = QProcess::NotRunning;
QString workingDirectory;
- Q_PID pid;
- int sequenceNumber;
+ Q_PID pid = 0;
+ int sequenceNumber = 0;
- bool dying;
- bool emittedReadyRead;
- bool emittedBytesWritten;
+ bool dying = false;
+ bool emittedReadyRead = false;
+ bool emittedBytesWritten = false;
Channel stdinChannel;
Channel stdoutChannel;
@@ -327,17 +327,17 @@ public:
#endif
QProcessEnvironment environment;
- Q_PIPE childStartedPipe[2];
+ Q_PIPE childStartedPipe[2] = {INVALID_Q_PIPE, INVALID_Q_PIPE};
void destroyPipe(Q_PIPE pipe[2]);
- QSocketNotifier *startupSocketNotifier;
- QSocketNotifier *deathNotifier;
+ QSocketNotifier *startupSocketNotifier = nullptr;
+ QSocketNotifier *deathNotifier = nullptr;
- int forkfd;
+ int forkfd = -1;
#ifdef Q_OS_WIN
- QTimer *stdinWriteTrigger;
- QWinEventNotifier *processFinishedNotifier;
+ QTimer *stdinWriteTrigger = nullptr;
+ QWinEventNotifier *processFinishedNotifier = nullptr;
#endif
void start(QIODevice::OpenMode mode);
@@ -361,9 +361,9 @@ public:
bool startDetached(qint64 *pPid);
- int exitCode;
- QProcess::ExitStatus exitStatus;
- bool crashed;
+ int exitCode = 0;
+ QProcess::ExitStatus exitStatus = QProcess::NormalExit;
+ bool crashed = false;
bool waitForStarted(int msecs = 30000);
bool waitForReadyRead(int msecs = 30000);