core: Allow clean shutdown of the core
authorManuel Nickschas <sputnick@quassel-irc.org>
Sat, 29 Sep 2018 15:31:42 +0000 (17:31 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 1 Oct 2018 17:06:49 +0000 (19:06 +0200)
commitddfb1d2574c4bffd180361a80df9b1cd584bb040
tree51112a13e864b6d592b63f1aa50dae92fdb9e8ff
parent72473527f99cbe68dcfcb4ca17f828bd3775bba7
core: Allow clean shutdown of the core

Relying on things to happen while the core is being destroyed is
fragile (and does not work in practice), because events are no
longer delivered to objects that are scheduled for deletion.

Add an explicit call for shutting down the core, its sessions and
their networks. Wait for everything to be cleaned up properly before
quitting the session threads, and ultimately shutting down the main
event loop.

While we're at it, refactor SessionThread to follow the worker
pattern, rather than inheriting from QThread. This avoids accidentally
calling slots in the wrong thread. Ensure that all cross-thread
communication happens through queued signals. Simplify the API, too.
src/core/core.cpp
src/core/core.h
src/core/coreapplication.cpp
src/core/coreapplication.h
src/core/coresession.cpp
src/core/coresession.h
src/core/sessionthread.cpp
src/core/sessionthread.h
src/qtui/monoapplication.cpp
src/qtui/monoapplication.h