This instance will be upgraded to Heptapod 0.19.0rc2 on 2021-01-18 at 11:00 UTC+1 (a few minutes of downtime)

Commit cc8098f1 authored by Yuya Nishihara's avatar Yuya Nishihara

repoagent: shut down command-server process on repository closed

Still RepoAgent may be deleted too early, because RepoManager does not wait
for serviceStopped.
parent 1ff0182d8523
......@@ -297,7 +297,9 @@ class RepoAgent(QObject):
repositoryDestroyed = pyqtSignal()
workingBranchChanged = pyqtSignal()
serviceStopped = pyqtSignal()
busyChanged = pyqtSignal(bool)
commandFinished = pyqtSignal(cmdcore.CmdSession)
outputReceived = pyqtSignal(unicode, unicode)
progressReceived = pyqtSignal(cmdcore.ProgressMessage)
......@@ -319,6 +321,7 @@ class RepoAgent(QObject):
cmdagent.setWorkingDirectory(self.rootPath())
cmdagent.outputReceived.connect(self.outputReceived)
cmdagent.progressReceived.connect(self.progressReceived)
cmdagent.serviceStopped.connect(self._tryEmitServiceStopped)
cmdagent.busyChanged.connect(self._onBusyChanged)
cmdagent.commandFinished.connect(self._onCommandFinished)
......@@ -341,9 +344,20 @@ class RepoAgent(QObject):
else:
self._watcher.startMonitoring()
def isServiceRunning(self):
return self._watcher.isMonitoring() or self._cmdagent.isServiceRunning()
def stopService(self):
"""Shut down back-end services on repository closed by RepoManager"""
self._watcher.stopMonitoring()
if self._watcher.isMonitoring():
self._watcher.stopMonitoring()
self._tryEmitServiceStopped()
self._cmdagent.stopService()
@pyqtSlot()
def _tryEmitServiceStopped(self):
if not self.isServiceRunning():
self.serviceStopped.emit()
def rawRepo(self):
return self._repo
......
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