Fixed bug with TargetController attempting to release hardware that it no longer has access to.
Under some circumstances, this bug was leaving the debug tool in a bad state.
This commit is contained in:
@@ -333,8 +333,12 @@ namespace Bloom
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TargetController::releaseHardware() {
|
void TargetController::releaseHardware() {
|
||||||
auto target = this->getTarget();
|
/*
|
||||||
auto debugTool = this->getDebugTool();
|
* Transferring ownership of this->debugTool and this->target to this function block means if an exception is
|
||||||
|
* thrown, the objects will still be destroyed.
|
||||||
|
*/
|
||||||
|
auto debugTool = std::move(this->debugTool);
|
||||||
|
auto target = std::move(this->target);
|
||||||
|
|
||||||
if (debugTool != nullptr && debugTool->isInitialised()) {
|
if (debugTool != nullptr && debugTool->isInitialised()) {
|
||||||
if (target != nullptr) {
|
if (target != nullptr) {
|
||||||
@@ -349,9 +353,6 @@ namespace Bloom
|
|||||||
Logger::info("Closing debug tool");
|
Logger::info("Closing debug tool");
|
||||||
debugTool->close();
|
debugTool->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
this->debugTool.reset();
|
|
||||||
this->target.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TargetController::loadRegisterDescriptors() {
|
void TargetController::loadRegisterDescriptors() {
|
||||||
|
|||||||
@@ -199,14 +199,6 @@ namespace Bloom
|
|||||||
return mapping;
|
return mapping;
|
||||||
}
|
}
|
||||||
|
|
||||||
Targets::Target* getTarget() {
|
|
||||||
return this->target.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
DebugTool* getDebugTool() {
|
|
||||||
return this->debugTool.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the state of the TargetController and emits a state changed event.
|
* Updates the state of the TargetController and emits a state changed event.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user