Bugfix for deleting delegates.

This commit is contained in:
Gunnar Beutner 2012-04-27 13:11:07 +02:00
parent 6b4647a5dc
commit 5c603ee98b
3 changed files with 35 additions and 6 deletions

View File

@ -33,16 +33,15 @@ public:
void operator()(const TArgs& args)
{
typename vector<DelegateType>::iterator prev, i;
typename vector<DelegateType>::iterator i;
for (i = m_Delegates.begin(); i != m_Delegates.end(); ) {
prev = i;
i++;
int result = (*prev)(args);
int result = (*i)(args);
if (result == -1)
m_Delegates.erase(prev);
i = m_Delegates.erase(i);
else
i++;
}
}
};

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClInclude Include="i2-demo.h" />
<ClInclude Include="democomponent.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="democomponent.cpp" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<ClCompile Include="jsonrpcclient.cpp" />
<ClCompile Include="jsonrpcserver.cpp" />
<ClCompile Include="message.cpp" />
<ClCompile Include="netstring.cpp" />
<ClCompile Include="jsonrpcrequest.cpp" />
<ClCompile Include="jsonrpcresponse.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="i2-jsonrpc.h" />
<ClInclude Include="jsonrpcclient.h" />
<ClInclude Include="jsonrpcserver.h" />
<ClInclude Include="message.h" />
<ClInclude Include="netstring.h" />
<ClInclude Include="jsonrpcrequest.h" />
<ClInclude Include="jsonrpcresponse.h" />
</ItemGroup>
</Project>