From 0f4d21d538c8cb4c8fb12cd285c4d7556714c2f3 Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Mon, 22 Sep 2008 17:40:12 +0200 Subject: [PATCH] Don't start a core in CoreApplication's dtor... fixes BR #322 --- src/core/coreapplication.cpp | 11 ++++++++--- src/core/coreapplication.h | 3 +++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/coreapplication.cpp b/src/core/coreapplication.cpp index d92e46d9..7098ab89 100644 --- a/src/core/coreapplication.cpp +++ b/src/core/coreapplication.cpp @@ -22,7 +22,9 @@ #include "core.h" -CoreApplicationInternal::CoreApplicationInternal() { +CoreApplicationInternal::CoreApplicationInternal() + : _coreCreated(false) +{ // put core-only arguments here CliParser *parser = Quassel::cliParser(); parser->addOption("port",'p', tr("The port quasselcore will listen at"), QString("4242")); @@ -33,8 +35,10 @@ CoreApplicationInternal::CoreApplicationInternal() { } CoreApplicationInternal::~CoreApplicationInternal() { - Core::saveState(); - Core::destroy(); + if(_coreCreated) { + Core::saveState(); + Core::destroy(); + } } bool CoreApplicationInternal::init() { @@ -51,6 +55,7 @@ bool CoreApplicationInternal::init() { } Core::instance(); // create and init the core + _coreCreated = true; if(!Quassel::isOptionSet("norestore")) { Core::restoreState(); diff --git a/src/core/coreapplication.h b/src/core/coreapplication.h index 14eec295..07fa5821 100644 --- a/src/core/coreapplication.h +++ b/src/core/coreapplication.h @@ -36,6 +36,9 @@ class CoreApplicationInternal { ~CoreApplicationInternal(); bool init(); + + private: + bool _coreCreated; }; class CoreApplication : public QCoreApplication, public Quassel { -- 2.20.1