Fix options getting deallocated early in C++ header

This commit is contained in:
Caelan Sayler
2024-12-19 14:29:14 +00:00
committed by Caelan
parent ea5049347b
commit 922704817c

View File

@@ -347,15 +347,17 @@ public:
* @param locator Override the default locator configuration (usually used for testing / mocks). * @param locator Override the default locator configuration (usually used for testing / mocks).
*/ */
UpdateManager(const std::string& urlOrPath, const UpdateOptions* options = nullptr, const VelopackLocatorConfig* locator = nullptr) { UpdateManager(const std::string& urlOrPath, const UpdateOptions* options = nullptr, const VelopackLocatorConfig* locator = nullptr) {
vpkc_update_options_t vpkc_options;
vpkc_update_options_t* pOptions = nullptr; vpkc_update_options_t* pOptions = nullptr;
if (options != nullptr) { if (options != nullptr) {
vpkc_update_options_t vpkc_options = to_c(*options); vpkc_options = to_c(*options);
pOptions = &vpkc_options; pOptions = &vpkc_options;
} }
vpkc_locator_config_t vpkc_locator;
vpkc_locator_config_t* pLocator = nullptr; vpkc_locator_config_t* pLocator = nullptr;
if (locator != nullptr) { if (locator != nullptr) {
vpkc_locator_config_t vpkc_locator = to_c(*locator); vpkc_locator = to_c(*locator);
pLocator = &vpkc_locator; pLocator = &vpkc_locator;
} }