Commit 97305136 authored by Nikolai Kosjar's avatar Nikolai Kosjar
Browse files

Clang: Stop sending data to backend on disconnect



This addresses

    SOFT ASSERT made fatal: "m_connection.isConnected()" in file
      src/plugins/clangcodemodel/clangbackendipcintegration.cpp, line 230

I could not reproduce the issue locally, so I'm leaving the soft asserts
untouched for now.

Change-Id: If1d55ba7bc7e2d1ac20ad992c6d0d43ceb0f5d73
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent 88bcd6a3
......@@ -51,6 +51,7 @@ ConnectionClient::ConnectionClient()
connectLocalSocketError();
connectLocalSocketConnected();
connectLocalSocketDisconnected();
}
void ConnectionClient::startProcessAndConnectToServerAsynchronously()
......@@ -230,6 +231,14 @@ void ConnectionClient::connectLocalSocketConnected()
&ConnectionClient::resetProcessIsStarting);
}
void ConnectionClient::connectLocalSocketDisconnected()
{
connect(&localSocket,
&QLocalSocket::disconnected,
this,
&ConnectionClient::disconnectedFromLocalSocket);
}
void ConnectionClient::finishProcess()
{
finishProcess(std::move(process_));
......
......@@ -76,6 +76,7 @@ public:
signals:
void connectedToLocalSocket();
void disconnectedFromLocalSocket();
void processFinished();
protected:
......@@ -102,6 +103,7 @@ private:
void printStandardError();
void connectLocalSocketConnected();
void connectLocalSocketDisconnected();
void connectProcessFinished(QProcess *process) const;
void connectProcessStarted(QProcess *process) const;
void disconnectProcessFinished(QProcess *process) const;
......
......@@ -313,11 +313,16 @@ IpcCommunicator::IpcCommunicator()
connect(Core::EditorManager::instance(), &Core::EditorManager::editorAboutToClose,
this, &IpcCommunicator::onEditorAboutToClose);
connect(Core::ICore::instance(), &Core::ICore::coreAboutToClose,
this, &IpcCommunicator::onCoreAboutToClose);
this, &IpcCommunicator::setupDummySender);
initializeBackend();
}
IpcCommunicator::~IpcCommunicator()
{
disconnect(&m_connection, 0, this, 0);
}
void IpcCommunicator::initializeBackend()
{
const QString clangBackEndProcessPath = backendProcessPath();
......@@ -329,6 +334,8 @@ void IpcCommunicator::initializeBackend()
connect(&m_connection, &ConnectionClient::connectedToLocalSocket,
this, &IpcCommunicator::onConnectedToBackend);
connect(&m_connection, &ConnectionClient::disconnectedFromLocalSocket,
this, &IpcCommunicator::setupDummySender);
m_connection.startProcessAndConnectToServerAsynchronously();
}
......@@ -633,7 +640,7 @@ void IpcCommunicator::onEditorAboutToClose(Core::IEditor *editor)
m_ipcReceiver.deleteProcessorsOfEditorWidget(textEditor->editorWidget());
}
void IpcCommunicator::onCoreAboutToClose()
void IpcCommunicator::setupDummySender()
{
m_ipcSender.reset(new DummyIpcSender);
}
......
......@@ -116,6 +116,7 @@ public:
public:
IpcCommunicator();
~IpcCommunicator();
void registerTranslationUnitsForEditor(const FileContainers &fileContainers);
void updateTranslationUnitsForEditor(const FileContainers &fileContainers);
......@@ -164,9 +165,11 @@ private:
void registerVisibleCppEditorDocumentAndMarkInvisibleDirty();
void registerCurrentCodeModelUiHeaders();
void setupDummySender();
void onConnectedToBackend();
void onDisconnectedFromBackend();
void onEditorAboutToClose(Core::IEditor *editor);
void onCoreAboutToClose();
void updateTranslationUnitVisiblity(const Utf8String &currentEditorFilePath,
const Utf8StringVector &visibleEditorsFilePaths);
......
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