| 483 | // |
| 484 | |
| 485 | void ToolManager::Destroy() |
| 486 | { |
| 487 | if ( mTopDock || mBotDock ) { // destroy at most once |
| 488 | wxEvtHandler::RemoveFilter(this); |
| 489 | |
| 490 | // Save the toolbar states |
| 491 | WriteConfig(); |
| 492 | |
| 493 | // This function causes the toolbars to be destroyed, so |
| 494 | // clear the configuration of the ToolDocks which refer to |
| 495 | // these toolbars. This change was needed to stop Audacity |
| 496 | // crashing when running with Jaws on Windows 10 1703. |
| 497 | mTopDock->GetConfiguration().Clear(); |
| 498 | mBotDock->GetConfiguration().Clear(); |
| 499 | |
| 500 | mTopDock = mBotDock = nullptr; // indicate that it has been destroyed |
| 501 | |
| 502 | for (auto &pair : mBars) |
| 503 | pair.second.reset(); |
| 504 | |
| 505 | mIndicator.reset(); |
| 506 | mMenuManagerSubscription.Reset(); |
| 507 | } |
| 508 | } |
| 509 | |
| 510 | ToolManager::~ToolManager() |
| 511 | { |
no test coverage detected