fix restart of hyperion. now devices closed before restart (#269)

This commit is contained in:
redPanther 2016-10-10 23:08:01 +02:00 committed by GitHub
parent e889996ae7
commit 37558a983f
3 changed files with 11 additions and 1 deletions

View File

@ -78,6 +78,10 @@ public:
///
~Hyperion();
///
/// free all alocated objects, should be called only from constructor or before restarting hyperion
///
void freeObjects();
static Hyperion* initInstance(const Json::Value& jsonConfig, const QJsonObject& qjsonConfig, const std::string configFile);
static Hyperion* getInstance();

View File

@ -594,7 +594,7 @@ Hyperion::Hyperion(const Json::Value &jsonConfig, const QJsonObject &qjsonConfig
}
Hyperion::~Hyperion()
void Hyperion::freeObjects()
{
// switch off all leds
clearall();
@ -608,6 +608,11 @@ Hyperion::~Hyperion()
delete _messageForwarder;
}
Hyperion::~Hyperion()
{
freeObjects();
}
unsigned Hyperion::getLedCount() const
{
return _ledString.leds().size();

View File

@ -903,6 +903,7 @@ void JsonClientConnection::handleConfigCommand(const QJsonObject& message, const
}
else if (subcommand == "reload")
{
_hyperion->freeObjects();
Process::restartHyperion();
sendErrorReply("failed to restart hyperion", full_command, tan);
}