Skip to content

Commit b1e2784

Browse files
Fix error when application is uninstalled manually
In case the application is uninstalled manually during working with current device, trying to install it again fails as at the end of install we are cleaning the old resources. However the for loop is modifying the object over which we iterrate and the code fails. So copy the object before iterrating over it.
1 parent e2eb8db commit b1e2784

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

IOSDeviceLib/IOSDeviceLib.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ void cleanup_file_resources(const std::string& device_identifier)
221221

222222
if (devices[device_identifier].apps_cache.size())
223223
{
224-
for (auto const& key_value_pair : devices[device_identifier].apps_cache)
224+
std::map<std::string, ApplicationCache> apps_cache_clone = devices[device_identifier].apps_cache;
225+
for (auto const& key_value_pair : apps_cache_clone)
225226
{
226227
cleanup_file_resources(device_identifier, key_value_pair.first);
227228
}

0 commit comments

Comments
 (0)