aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2021-06-10 13:36:26 +0000
committerAndre Heinecke <[email protected]>2021-06-10 13:36:26 +0000
commitb3b75c37e2d3ef313031ceba8063feeccb0583ec (patch)
tree2ced57a82a59f546472c926c2fa47829fd6dabf9
parentcore,w32: Increase BUFFER_SIZE to 4096 (diff)
downloadgpgme-b3b75c37e2d3ef313031ceba8063feeccb0583ec.tar.gz
gpgme-b3b75c37e2d3ef313031ceba8063feeccb0583ec.zip
qt: Flush output after write for QProcess output
* lang/qt/src/dataprovider.cpp (QIODeviceDataProvider::write): Call waitForBytesWritten. -- The problem here is that QProcess writes into an internal buffer which is written to stdin of the process triggered by a signal/slot connection. That connection is broken when we move the QProcess into our GPGME thread and only restablished when our Job is finished. This caused Kleopatra to basically keep everything when decrypting a large archive in memory and only write it out to the unpack process once the decryption was finished. GnuPG-Bug-Id: T5475
-rw-r--r--lang/qt/src/dataprovider.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lang/qt/src/dataprovider.cpp b/lang/qt/src/dataprovider.cpp
index a025a03e..820ccbb3 100644
--- a/lang/qt/src/dataprovider.cpp
+++ b/lang/qt/src/dataprovider.cpp
@@ -248,7 +248,17 @@ ssize_t QIODeviceDataProvider::write(const void *buffer, size_t bufSize)
return -1;
}
- return mIO->write(static_cast<const char *>(buffer), bufSize);
+ ssize_t ret = mIO->write(static_cast<const char *>(buffer), bufSize);
+ if (mHaveQProcess) {
+ /* XXX: With at least Qt 5.12 we have the problem that the acutal write
+ * would be triggered by an event / slot. So as we have moved the io
+ * device to our thread this is never triggered until the job is finished
+ * calling waitForBytesWritten internally triggers a _q_canWrite which will
+ * actually write. This is what we want as we want to stream and not to
+ * buffer endlessly. */
+ qobject_cast<QProcess *>(mIO.get())->waitForBytesWritten(0);
+ }
+ return ret;
}
off_t QIODeviceDataProvider::seek(off_t offset, int whence)