From dc37537797096ec34ff1e0d8a3a0cc5ef98bf4a4 Mon Sep 17 00:00:00 2001 From: Jonathan White Date: Fri, 10 Jan 2020 22:31:56 -0500 Subject: [PATCH] Prevent proxy host from blocking application shutdown * Fix #4079 - proxy host would get stuck trying to read characters from stdin. Switch to "readsome" which does not block if there are not enough characters to read. Added a longer delay to slow the checking loop down. --- src/browser/NativeMessagingBase.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/browser/NativeMessagingBase.cpp b/src/browser/NativeMessagingBase.cpp index b44875b14..208d28a1e 100644 --- a/src/browser/NativeMessagingBase.cpp +++ b/src/browser/NativeMessagingBase.cpp @@ -106,9 +106,9 @@ void NativeMessagingBase::readNativeMessages() quint32 length = 0; while (m_running.load() != 0 && !std::cin.eof()) { length = 0; - std::cin.read(reinterpret_cast(&length), 4); + std::cin.readsome(reinterpret_cast(&length), 4); readStdIn(length); - QThread::msleep(1); + QThread::msleep(100); } #endif }