| 557 | } |
| 558 | |
| 559 | Analyzer::~Analyzer() |
| 560 | { |
| 561 | if (this->instance != nullptr) { |
| 562 | this->halt(); // Halt while thread is still running, so the thread can be aware of it |
| 563 | if (this->asyncThread != nullptr) { |
| 564 | this->asyncThread->quit(); |
| 565 | this->asyncThread->wait(); |
| 566 | delete this->asyncThread; |
| 567 | this->asyncThread = nullptr; |
| 568 | } |
| 569 | // Async thread is safely destroyed, proceed to destroy instance |
| 570 | suscan_analyzer_destroy(this->instance); |
| 571 | this->instance = nullptr; |
| 572 | } |
| 573 | } |
| 574 |