Make objects static so light object references remain valid after detection

This commit is contained in:
Adam Honse
2020-11-21 00:47:44 -06:00
parent 2bcea881ae
commit fe184e2fc9

View File

@@ -43,7 +43,7 @@ void DetectPhilipsHueControllers(std::vector<RGBController*>& rgb_controllers)
/*-------------------------------------------------*\
| Create a finder and find bridges |
\*-------------------------------------------------*/
hueplusplus::BridgeFinder finder(handler);
static hueplusplus::BridgeFinder finder(handler);
std::vector<hueplusplus::BridgeFinder::BridgeIdentification> bridges;// = finder.FindBridges();
/*-------------------------------------------------*\
@@ -107,7 +107,7 @@ void DetectPhilipsHueControllers(std::vector<RGBController*>& rgb_controllers)
| away. If not, the user will have to push the |
| connect button on the bridge. |
\*-------------------------------------------------*/
hueplusplus::Bridge bridge = finder.GetBridge(bridges[0]);
static hueplusplus::Bridge bridge = finder.GetBridge(bridges[0]);
/*-------------------------------------------------*\
| Check to see if we need to save the settings |