| 494 | |
| 495 | |
| 496 | Engine::~Engine() { |
| 497 | // Stop fallback thread if running |
| 498 | { |
| 499 | std::lock_guard<std::mutex> lock(internal->fallbackMutex); |
| 500 | internal->fallbackRunning = false; |
| 501 | internal->fallbackCv.notify_all(); |
| 502 | } |
| 503 | if (internal->fallbackThread.joinable()) |
| 504 | internal->fallbackThread.join(); |
| 505 | |
| 506 | // Shut down workers |
| 507 | Engine_relaunchWorkers(this, 0); |
| 508 | |
| 509 | // Clear modules, cables, etc |
| 510 | clear(); |
| 511 | |
| 512 | // Make sure there are no cables or modules in the rack on destruction. |
| 513 | // If this happens, a module must have failed to remove itself before the RackWidget was destroyed. |
| 514 | assert(internal->cables.empty()); |
| 515 | assert(internal->modules.empty()); |
| 516 | assert(internal->paramHandles.empty()); |
| 517 | |
| 518 | assert(internal->modulesCache.empty()); |
| 519 | assert(internal->cablesCache.empty()); |
| 520 | assert(internal->paramHandlesCache.empty()); |
| 521 | |
| 522 | delete internal; |
| 523 | } |
| 524 | |
| 525 | |
| 526 | void Engine::clear() { |
nothing calls this directly
no test coverage detected