logic: release fixes
* disable windows error dialogs on application crash for indexer target * show indexing dialog at the start of indexing task instead of waiting for processes to start * fix escaping path to binary for indexer process * join garbagecollector thread when stopping * fix compile errors related to FilePath in deploy mode on windows
This commit is contained in:
@@ -29,6 +29,13 @@ void setupLogging(const std::string logFilePath)
|
|||||||
logManager->addLogger(fileLogger);
|
logManager->addLogger(fileLogger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void suppressCrashMessage()
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX);
|
||||||
|
#endif // _WIN32
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication qtApp(argc, argv);
|
QCoreApplication qtApp(argc, argv);
|
||||||
@@ -68,6 +75,7 @@ int main(int argc, char *argv[])
|
|||||||
UserPaths::setUserDataPath(FilePath(userDataPath));
|
UserPaths::setUserDataPath(FilePath(userDataPath));
|
||||||
|
|
||||||
setupLogging(logFilePath);
|
setupLogging(logFilePath);
|
||||||
|
suppressCrashMessage();
|
||||||
|
|
||||||
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
ApplicationSettings* appSettings = ApplicationSettings::getInstance().get();
|
||||||
appSettings->load(FilePath(UserPaths::getAppSettingsPath()));
|
appSettings->load(FilePath(UserPaths::getAppSettingsPath()));
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ TaskBuildIndex::TaskBuildIndex(
|
|||||||
|
|
||||||
void TaskBuildIndex::doEnter(std::shared_ptr<Blackboard> blackboard)
|
void TaskBuildIndex::doEnter(std::shared_ptr<Blackboard> blackboard)
|
||||||
{
|
{
|
||||||
|
updateIndexingDialog(blackboard, FilePath());
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(blackboard->getMutex());
|
std::lock_guard<std::mutex> lock(blackboard->getMutex());
|
||||||
blackboard->set("indexer_count", (int)m_processCount);
|
blackboard->set("indexer_count", (int)m_processCount);
|
||||||
@@ -177,7 +179,7 @@ void TaskBuildIndex::runIndexerProcess(int processId, const std::string& logFile
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string command = indexerProcessPath.str();
|
std::string command = "\"" + indexerProcessPath.str() + "\"";
|
||||||
command += " " + std::to_string(processId);
|
command += " " + std::to_string(processId);
|
||||||
command += " " + Application::getUUID();
|
command += " " + Application::getUUID();
|
||||||
command += " \"" + AppPath::getAppPath() + "\"";
|
command += " \"" + AppPath::getAppPath() + "\"";
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ void SharedMemoryGarbageCollector::run(const std::string& uuid)
|
|||||||
|
|
||||||
m_uuid = uuid;
|
m_uuid = uuid;
|
||||||
|
|
||||||
std::thread(
|
m_thread = std::make_shared<std::thread>(
|
||||||
[this]()
|
[this]()
|
||||||
{
|
{
|
||||||
m_loopIsRunning = true;
|
m_loopIsRunning = true;
|
||||||
@@ -57,7 +57,7 @@ void SharedMemoryGarbageCollector::run(const std::string& uuid)
|
|||||||
std::this_thread::sleep_for(std::chrono::seconds(s_updateIntervalSeconds));
|
std::this_thread::sleep_for(std::chrono::seconds(s_updateIntervalSeconds));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).detach();
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SharedMemoryGarbageCollector::stop()
|
void SharedMemoryGarbageCollector::stop()
|
||||||
@@ -66,6 +66,9 @@ void SharedMemoryGarbageCollector::stop()
|
|||||||
|
|
||||||
m_loopIsRunning = false;
|
m_loopIsRunning = false;
|
||||||
|
|
||||||
|
m_thread->join();
|
||||||
|
m_thread.reset();
|
||||||
|
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_sharedMemoryNamesMutex);
|
std::lock_guard<std::mutex> lock(m_sharedMemoryNamesMutex);
|
||||||
m_removedSharedMemoryNames.insert(m_sharedMemoryNames.begin(), m_sharedMemoryNames.end());
|
m_removedSharedMemoryNames.insert(m_sharedMemoryNames.begin(), m_sharedMemoryNames.end());
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#ifndef SHARED_MEMORY_GARBAGE_COLLECTOR_H
|
#ifndef SHARED_MEMORY_GARBAGE_COLLECTOR_H
|
||||||
#define SHARED_MEMORY_GARBAGE_COLLECTOR_H
|
#define SHARED_MEMORY_GARBAGE_COLLECTOR_H
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <set>
|
#include <set>
|
||||||
@@ -38,6 +39,7 @@ private:
|
|||||||
|
|
||||||
SharedMemory m_memory;
|
SharedMemory m_memory;
|
||||||
volatile bool m_loopIsRunning;
|
volatile bool m_loopIsRunning;
|
||||||
|
std::shared_ptr<std::thread> m_thread;
|
||||||
|
|
||||||
std::string m_uuid;
|
std::string m_uuid;
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ void setupApp(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
path += "Sourcetrail/";
|
path += "Sourcetrail/";
|
||||||
}
|
}
|
||||||
UserPaths::setUserDataPath(path);
|
UserPaths::setUserDataPath(FilePath(path));
|
||||||
#else
|
#else
|
||||||
std::string path = QDir::currentPath().toStdString();
|
std::string path = QDir::currentPath().toStdString();
|
||||||
path += "/user/";
|
path += "/user/";
|
||||||
@@ -41,20 +41,20 @@ void setupApp(int argc, char *argv[])
|
|||||||
|
|
||||||
#ifdef DEPLOY
|
#ifdef DEPLOY
|
||||||
// try to find files in Coati installation to migrate to Sourcetrail
|
// try to find files in Coati installation to migrate to Sourcetrail
|
||||||
FilePath coatiUserDataPath = UserPaths::getUserDataPath() + "../";
|
FilePath coatiUserDataPath = UserPaths::getUserDataPath().concat(FilePath("../"));
|
||||||
if (utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64)
|
if (utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64)
|
||||||
{
|
{
|
||||||
coatiUserDataPath = coatiUserDataPath.concat("Coati 64-bit");
|
coatiUserDataPath = coatiUserDataPath.concat(FilePath("Coati 64-bit"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
coatiUserDataPath = coatiUserDataPath.concat("Coati");
|
coatiUserDataPath = coatiUserDataPath.concat(FilePath("Coati"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (coatiUserDataPath.exists())
|
if (coatiUserDataPath.exists())
|
||||||
{
|
{
|
||||||
FileSystem::copyFile(coatiUserDataPath.concat("ApplicationSettings.xml"), UserPaths::getAppSettingsPath());
|
FileSystem::copyFile(coatiUserDataPath.concat(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
|
||||||
FileSystem::copyFile(coatiUserDataPath.concat("window_settings.ini"), UserPaths::getWindowSettingsPath());
|
FileSystem::copyFile(coatiUserDataPath.concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user