| 619 | } |
| 620 | |
| 621 | static void handleSceneCollectionCleanup() |
| 622 | { |
| 623 | // Reset the plugin to default settings to avoid settings being carried |
| 624 | // over to newly created scene collections. |
| 625 | |
| 626 | // Skip this step for the initial OBS startup. |
| 627 | // OBSBasic::LoadData() will call ClearSceneData() which will trigger |
| 628 | // this function to be called. |
| 629 | // This would result in the plugin being started with default settings |
| 630 | // before the "real" settings are loaded. |
| 631 | static bool isOBSStartup = true; |
| 632 | if (isOBSStartup) { |
| 633 | isOBSStartup = false; |
| 634 | return; |
| 635 | } |
| 636 | |
| 637 | // OBS_FRONTEND_EVENT_SCENE_COLLECTION_CLEANUP is also called on |
| 638 | // shutdown. |
| 639 | // Here we also don't want to clear the settings. |
| 640 | if (switcher->obsIsShuttingDown) { |
| 641 | return; |
| 642 | } |
| 643 | |
| 644 | SaveSceneSwitcher(nullptr, false, nullptr); |
| 645 | } |
| 646 | |
| 647 | // Note to future self: |
| 648 | // be careful using switcher->m here as there is potential for deadlocks when using |
no test coverage detected