MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / Cleanup

Method Cleanup

ResourceManager.cpp:651–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

649}
650
651void ResourceManager::Cleanup()
652{
653 ResourceManager::get()->WaitForDeviceDetection();
654
655 std::vector<RGBController *> rgb_controllers_hw_copy = rgb_controllers_hw;
656
657 for(unsigned int hw_controller_idx = 0; hw_controller_idx < rgb_controllers_hw.size(); hw_controller_idx++)
658 {
659 for(unsigned int controller_idx = 0; controller_idx < rgb_controllers.size(); controller_idx++)
660 {
661 if(rgb_controllers[controller_idx] == rgb_controllers_hw[hw_controller_idx])
662 {
663 rgb_controllers.erase(rgb_controllers.begin() + controller_idx);
664 break;
665 }
666 }
667 }
668
669 /*-------------------------------------------------*\
670 | Clear the hardware controllers list and set the |
671 | previous hardware controllers list size to zero |
672 \*-------------------------------------------------*/
673 rgb_controllers_hw.clear();
674 detection_prev_size = 0;
675
676 for(RGBController* rgb_controller : rgb_controllers_hw_copy)
677 {
678 delete rgb_controller;
679 }
680
681 std::vector<i2c_smbus_interface *> busses_copy = busses;
682
683 busses.clear();
684
685 for(i2c_smbus_interface* bus : busses_copy)
686 {
687 delete bus;
688 }
689
690 /*-------------------------------------------------*\
691 | Cleanup HID interface |
692 \*-------------------------------------------------*/
693 int hid_status = hid_exit();
694
695 LOG_DEBUG("Closing HID interfaces: %s", ((hid_status == 0) ? "Success" : "Failed"));
696
697 if(DetectDevicesThread)
698 {
699 DetectDevicesThread->join();
700 delete DetectDevicesThread;
701 DetectDevicesThread = nullptr;
702 }
703}
704
705void ResourceManager::ProcessPreDetectionHooks()
706{

Callers

nothing calls this directly

Calls 5

getFunction · 0.50
sizeMethod · 0.45
eraseMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected