diff --git a/source/config/WUPSConfigAPI.cpp b/source/config/WUPSConfigAPI.cpp index adc5322..fb9254c 100644 --- a/source/config/WUPSConfigAPI.cpp +++ b/source/config/WUPSConfigAPI.cpp @@ -186,7 +186,7 @@ namespace WUPSConfigAPIBackend { if (!remove_locked_first_if(sConfigCategoryMutex, sConfigCategories, [&handle](auto &cur) { return handle == cur.get(); })) { { - // Ignore any attempts to destroy to create root item. + // Ignore any attempts to destroy the root item. std::lock_guard lock(sConfigsMutex); if (std::any_of(sConfigs.begin(), sConfigs.end(), [&handle](auto &cur) { return handle == cur.get(); })) { return WUPSCONFIG_API_RESULT_SUCCESS; diff --git a/source/utils/exports.cpp b/source/utils/exports.cpp index 9047ff9..6b30541 100644 --- a/source/utils/exports.cpp +++ b/source/utils/exports.cpp @@ -46,8 +46,9 @@ extern "C" PluginBackendApiErrorType WUPSLoadAndLinkByDataHandle(const wups_back extern "C" PluginBackendApiErrorType WUPSDeletePluginData(const wups_backend_plugin_data_handle *plugin_data_handle_list, uint32_t plugin_data_handle_list_size) { if (plugin_data_handle_list != nullptr && plugin_data_handle_list_size != 0) { + std::lock_guard lock(gLoadedDataMutex); for (auto &handle : std::span(plugin_data_handle_list, plugin_data_handle_list_size)) { - if (!remove_locked_first_if(gLoadedDataMutex, gLoadedData, [&handle](auto &cur) { return cur->getHandle() == handle; })) { + if (!remove_first_if(gLoadedData, [&handle](auto &cur) { return cur->getHandle() == handle; })) { DEBUG_FUNCTION_LINE_ERR("Failed to delete plugin data by handle %08X", handle); } } diff --git a/source/utils/storage/StorageUtils.cpp b/source/utils/storage/StorageUtils.cpp index 688e07d..c6e3e86 100644 --- a/source/utils/storage/StorageUtils.cpp +++ b/source/utils/storage/StorageUtils.cpp @@ -425,7 +425,7 @@ namespace StorageUtils { auto res = StorageUtils::Helper::WriteStorageToSD(root, false); // TODO: handle write error? - if (!remove_locked_first_if(gStorageMutex, gStorage, [&root](auto &cur) { return cur.getHandle() == (uint32_t) root; })) { + if (!remove_first_if(gStorage, [&root](auto &cur) { return cur.getHandle() == (uint32_t) root; })) { DEBUG_FUNCTION_LINE_WARN("Failed to close storage: Not opened (\"%08X\")", root); return WUPS_STORAGE_ERROR_NOT_FOUND; }