From: Ivailo Monev Date: Fri, 8 Jan 2021 11:39:02 +0000 (+0200) Subject: keep QByteArray reference in QProcessPrivate::createChannel() X-Git-Tag: 4.12.0~2790 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=04bd8bdbd3abf51035544bd9d0939b40451fad51;p=kde%2FKatie.git keep QByteArray reference in QProcessPrivate::createChannel() Signed-off-by: Ivailo Monev --- diff --git a/src/core/io/qprocess_unix.cpp b/src/core/io/qprocess_unix.cpp index 69307ddec..24d3381b1 100644 --- a/src/core/io/qprocess_unix.cpp +++ b/src/core/io/qprocess_unix.cpp @@ -382,12 +382,12 @@ bool QProcessPrivate::createChannel(Channel &channel) return true; } else if (channel.type == Channel::Redirect) { // we're redirecting the channel to/from a file - const char* fname = QFile::encodeName(channel.file).constData(); + const QByteArray fname = QFile::encodeName(channel.file); if (&channel == &stdinChannel) { // try to open in read-only mode channel.pipe[1] = -1; - if ( (channel.pipe[0] = qt_safe_open(fname, O_RDONLY)) != -1) + if ( (channel.pipe[0] = qt_safe_open(fname.constData(), O_RDONLY)) != -1) return true; // success q->setErrorString(QProcess::tr("Could not open input redirection for reading")); @@ -399,7 +399,7 @@ bool QProcessPrivate::createChannel(Channel &channel) mode |= O_TRUNC; channel.pipe[0] = -1; - if ( (channel.pipe[1] = qt_safe_open(fname, mode, 0666)) != -1) + if ( (channel.pipe[1] = qt_safe_open(fname.constData(), mode, 0666)) != -1) return true; // success q->setErrorString(QProcess::tr("Could not open output redirection for writing"));