Commit 5d51bd93 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Ensure end command is send before waiting for process finish

This reverts

    CmbIpc: Remove workaround
    287a2630

since the bug still exists. However, we use waitForBytesWritten()
instead of QCoreApplication::processEvents() since this seems to be fine
(QAbstractSocket::waitForBytesWritten is not called on Windows).

The bug was:
 1. Open a bigger project, like qtcreator.pro.
 2. After 2 seconds, quit it.
 ==> The Qt Creator window is gone but the Qt Creator process waits
     until the clangbackend process is finished.

Change-Id: I25c475d2a6db94a1c3a8d827a41f8c0b2624eaea
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent 649acd35
......@@ -95,10 +95,17 @@ bool ConnectionClient::isConnected() const
return localSocket.state() == QLocalSocket::ConnectedState;
}
void ConnectionClient::ensureCommandIsWritten()
{
while (localSocket.bytesToWrite() > 0)
localSocket.waitForBytesWritten();
}
void ConnectionClient::sendEndCommand()
{
serverProxy_.end();
localSocket.flush();
ensureCommandIsWritten();
}
void ConnectionClient::resetProcessAliveTimer()
......
......@@ -97,7 +97,7 @@ private:
void disconnectProcessFinished() const;
void connectStandardOutputAndError() const;
void waitUntilSocketIsFlushed() const;
void ensureCommandIsWritten();
private:
mutable std::unique_ptr<QProcess> process_;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment