fix: Race condition during data processor execution
This commit is contained in:
parent
29558c9910
commit
a7115d4300
@ -532,11 +532,22 @@ namespace hex::plugin::builtin {
|
|||||||
task.setInterruptCallback([]{
|
task.setInterruptCallback([]{
|
||||||
dp::Node::interrupt();
|
dp::Node::interrupt();
|
||||||
});
|
});
|
||||||
do {
|
|
||||||
|
|
||||||
|
const auto handleError = [workspace] {
|
||||||
|
TaskManager::doLater([workspace] {
|
||||||
|
// Delete all overlays
|
||||||
|
for (auto overlay : workspace->dataOverlays)
|
||||||
|
ImHexApi::Provider::get()->deleteOverlay(overlay);
|
||||||
|
workspace->dataOverlays.clear();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
do {
|
||||||
// Process all nodes in the workspace
|
// Process all nodes in the workspace
|
||||||
try {
|
try {
|
||||||
for (auto &endNode : workspace->endNodes) {
|
for (auto &endNode : workspace->endNodes) {
|
||||||
|
task.update();
|
||||||
|
|
||||||
// Reset the output data of the end node
|
// Reset the output data of the end node
|
||||||
endNode->resetOutputData();
|
endNode->resetOutputData();
|
||||||
|
|
||||||
@ -554,20 +565,24 @@ namespace hex::plugin::builtin {
|
|||||||
|
|
||||||
// Add the node error to the current workspace, so it can be displayed
|
// Add the node error to the current workspace, so it can be displayed
|
||||||
workspace->currNodeError = e;
|
workspace->currNodeError = e;
|
||||||
|
handleError();
|
||||||
|
|
||||||
// Delete all overlays
|
break;
|
||||||
for (auto overlay : workspace->dataOverlays)
|
|
||||||
ImHexApi::Provider::get()->deleteOverlay(overlay);
|
|
||||||
workspace->dataOverlays.clear();
|
|
||||||
} catch (const std::runtime_error &e) {
|
} catch (const std::runtime_error &e) {
|
||||||
// Handle internal errors
|
// Handle internal errors
|
||||||
|
|
||||||
log::fatal("Data processor node implementation bug! {}", e.what());
|
log::fatal("Data processor node implementation bug! {}", e.what());
|
||||||
|
handleError();
|
||||||
|
|
||||||
|
break;
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
// Handle other fatal errors
|
// Handle other fatal errors
|
||||||
log::fatal("Unhandled exception thrown in data processor node! {}", e.what());
|
|
||||||
}
|
|
||||||
|
|
||||||
task.update();
|
log::fatal("Unhandled exception thrown in data processor node! {}", e.what());
|
||||||
|
handleError();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
} while (m_continuousEvaluation);
|
} while (m_continuousEvaluation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user