added setting to restart on SIGSEGV

This commit is contained in:
fourtf
2019-09-22 15:32:36 +02:00
parent 7e555843ca
commit 431d35e528
6 changed files with 96 additions and 44 deletions
+25 -1
View File
@@ -32,7 +32,9 @@
#include "singletons/WindowManager.hpp"
#include "util/IsBigEndian.hpp"
#include "util/PostToThread.hpp"
#include "widgets/Notebook.hpp"
#include "widgets/Window.hpp"
#include "widgets/splits/Split.hpp"
namespace chatterino {
@@ -78,13 +80,35 @@ void Application::initialize(Settings &settings, Paths &paths)
assert(isAppInitialized == false);
isAppInitialized = true;
Irc::getInstance().load();
//Irc::getInstance().load();
for (auto &singleton : this->singletons_)
{
singleton->initialize(settings, paths);
}
// add crash message
if (getArgs().crashRecovery)
{
if (auto selected =
this->windows->getMainWindow().getNotebook().getSelectedPage())
{
if (auto container = dynamic_cast<SplitContainer *>(selected))
{
for (auto &&split : container->getSplits())
{
if (auto channel = split->getChannel(); !channel->isEmpty())
{
channel->addMessage(makeSystemMessage(
"Chatterino unexpectedly crashed and restarted. "
"You can disable automatic restarts in the "
"settings."));
}
}
}
}
}
this->windows->updateWordTypeMask();
this->initNm(paths);