diff options
author | Alexander Volkov <a.volkov@rusbitech.ru> | 2014-10-24 16:44:44 +0400 |
---|---|---|
committer | Alexander Volkov <a.volkov@rusbitech.ru> | 2014-12-22 20:28:05 +0100 |
commit | 86ec599997adcd08babc818217be4d179c8d5666 (patch) | |
tree | a12687ea37106eb72b3c093286376edd88421c92 | |
parent | 58bd34016974dbbd0d99adfd497b9aab8ad273bf (diff) | |
download | qttools-86ec599997adcd08babc818217be4d179c8d5666.tar.gz |
Assistant: Fix high CPU usage if a parent process finishes
If Assistant has been started in the remote control mode in Linux
and it's parent process finishes, then Assistant increases CPU load
to 100% and continuously raises it's window.
It is because QSocketNotifier for stdin continuously emits
activated() signal although there is no data to read.
So disable the notifier after receiving EOF.
Change-Id: I1b01108e1b97bc4fd54411b16489082be7f47bf4
Reviewed-by: Karsten Heimrich <karsten.heimrich@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
-rw-r--r-- | src/assistant/assistant/stdinlistener.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/assistant/assistant/stdinlistener.cpp b/src/assistant/assistant/stdinlistener.cpp index 36cf8fb59..857b29701 100644 --- a/src/assistant/assistant/stdinlistener.cpp +++ b/src/assistant/assistant/stdinlistener.cpp @@ -60,7 +60,11 @@ void StdInListener::receivedData() QByteArray ba; while (true) { const int c = getc(stdin); - if (c == EOF || c == '\0') + if (c == EOF) { + setEnabled(false); + break; + } + if (c == '\0') break; if (c) ba.append(char(c)); |