Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/server/appserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ AppServer::AppServer(int &argc, char **argv) :
}

AppServer::~AppServer() {
if (_clientProcess && _clientProcess->isOpen()) {
_clientProcess->kill();
}

if (Log::isSet()) {
LOG_DEBUG(_logger, "~AppServer");
}
Expand Down Expand Up @@ -459,7 +463,10 @@ void AppServer::cleanup() {
LOG_DEBUG(_logger, "AppServer::cleanup");

// Stop CommManager
_commManager->stop();
if (_commManager) {
_commManager->stop();
LOG_DEBUG(_logger, "CommManager stopped");
}

// Stop JobManager(s)
GuiJobManagerSingleton::instance()->stop();
Expand Down Expand Up @@ -3408,11 +3415,11 @@ bool AppServer::startClient() {
LOGW_INFO(_logger, L"Starting kDrive client - path=" << Path2WStr(QStr2Path(pathToExecutable)) << L" args="
<< arguments[0].toStdWString());

QProcess *clientProcess = new QProcess(this);
clientProcess->setProgram(pathToExecutable);
clientProcess->setArguments(arguments);
clientProcess->start();
if (!clientProcess->waitForStarted()) {
_clientProcess = new QProcess(this);
_clientProcess->setProgram(pathToExecutable);
_clientProcess->setArguments(arguments);
_clientProcess->start();
if (!_clientProcess->waitForStarted()) {
LOG_WARN(_logger, "Failed to start kDrive client");
return false;
}
Expand Down
6 changes: 4 additions & 2 deletions src/server/appserver.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <QApplication>
#include <QElapsedTimer>
#include <QPointer>
#include <QProcess>
#include <QQueue>
#include <QTimer>

Expand Down Expand Up @@ -142,8 +143,8 @@ class AppServer : public SharedTools::QtSingleApplication {
static VfsMap _vfsMap;
static std::vector<Notification> _notifications;

std::unique_ptr<NavigationPaneHelper> _navigationPaneHelper;
std::shared_ptr<CommManager> _commManager;
std::unique_ptr<NavigationPaneHelper> _navigationPaneHelper = nullptr;
std::shared_ptr<CommManager> _commManager = nullptr;
bool _appRestartRequired{false};
Theme *_theme{nullptr};
bool _helpAsked{false};
Expand All @@ -165,6 +166,7 @@ class AppServer : public SharedTools::QtSingleApplication {
QTimer _restartSyncsTimer;
std::unordered_map<int, SyncCache> _syncCacheMap;
std::unordered_map<int, NodeSet> _undecidedListCacheMap;
QProcess *_clientProcess = nullptr;

static std::unique_ptr<UpdateManager> _updateManager;

Expand Down
Loading