Commit cb32dba0 authored by Cory Quammen's avatar Cory Quammen
Browse files

Fix proxy name lookup by index

vtkSMSessionProxyManager::GetProxyName(const char* groupname, unsigned
int idx) was effectively treating the idx parameter as the index into
the proxy names. This commit changes idx to instead be an aggregate
index into the vectors of proxies associated with the proxy names
instead. This is consistent the function
vtkSMSessionProxyManager::GetNumberOfProxies(const char* group)
when used to iterate over all proxies in a given group name, for
instance.

This corrects a bug that manifested when loading a ProxyCollection of
textures assigned the same name attribute in a state file. This could
arise when loading state files from older versions of ParaView that
did not ensure that texture names were unique.
parent 3db9063c
......@@ -672,11 +672,14 @@ const char* vtkSMSessionProxyManager::GetProxyName(const char* groupname, unsign
vtkSMProxyManagerProxyMapType::iterator it2 = it->second.begin();
for (; it2 != it->second.end(); it2++)
{
if (counter == idx)
if (idx < counter + it2->second.size())
{
// idx is between counter and the size of the next vector of
// proxies, so return the current proxy map key
return it2->first.c_str();
}
counter++;
counter += it2->second.size();
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment