From 3c21af200cde8b31f9edc488072a5e13322ba008 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Thu, 29 Jun 2017 15:17:42 +0300 Subject: [PATCH] revert: "refactor(core): Remove unused Core::reset method" This reverts commit 4664c6249a96ebebe324a9c23f1dea60ce040318. --- src/core/core.cpp | 15 +++++++++++++++ src/core/core.h | 1 + 2 files changed, 16 insertions(+) diff --git a/src/core/core.cpp b/src/core/core.cpp index 9e935b510..fb895326b 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -1435,3 +1435,18 @@ void Core::killTimers(bool onlyStop) toxTimer = nullptr; } } + +/** + * @brief Reinitialized the core. + * @warning Must be called from the Core thread, with the GUI thread ready to process events. + */ +void Core::reset() +{ + assert(QThread::currentThread() == coreThread); + QByteArray toxsave = getToxSaveData(); + ready = false; + killTimers(true); + deadifyTox(); + GUI::clearContacts(); + start(toxsave); +} diff --git a/src/core/core.h b/src/core/core.h index f1bb115d9..9159976f8 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -78,6 +78,7 @@ public: public slots: void start(const QByteArray& savedata); + void reset(); void process(); void bootstrapDht();