From 431abcb63aac8989c5e1d88f7972fe97115cfc7e Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Wed, 3 Sep 2014 20:06:49 +0200 Subject: [PATCH] handle shutdown of OpenMW processes when shutting down OpenCS --- apps/opencs/model/doc/runner.cpp | 10 ++++++++++ apps/opencs/model/doc/runner.hpp | 2 ++ 2 files changed, 12 insertions(+) diff --git a/apps/opencs/model/doc/runner.cpp b/apps/opencs/model/doc/runner.cpp index 47daa8656f..ce34f2b710 100644 --- a/apps/opencs/model/doc/runner.cpp +++ b/apps/opencs/model/doc/runner.cpp @@ -9,6 +9,16 @@ CSMDoc::Runner::Runner() : mRunning (false) this, SLOT (finished (int, QProcess::ExitStatus))); } +CSMDoc::Runner::~Runner() +{ + if (mRunning) + { + disconnect (&mProcess, 0, this, 0); + mProcess.kill(); + mProcess.waitForFinished(); + } +} + void CSMDoc::Runner::start (bool delayed) { if (!delayed) diff --git a/apps/opencs/model/doc/runner.hpp b/apps/opencs/model/doc/runner.hpp index 4a0302670c..7d1bbd5052 100644 --- a/apps/opencs/model/doc/runner.hpp +++ b/apps/opencs/model/doc/runner.hpp @@ -17,6 +17,8 @@ namespace CSMDoc Runner(); + ~Runner(); + /// \param delayed Flag as running but do not start the OpenMW process yet (the /// process must be started by another call of start with delayed==false) void start (bool delayed = false);