Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support to remove a delegate while emmiting a signal

  • Loading branch information...
commit 0e516c90d6771768ee636d8e3842111a18a85c35 1 parent ed97cfc
@scooterman authored
Showing with 16 additions and 8 deletions.
  1. +16 −8 Signal.h
View
24 Signal.h
@@ -68,7 +68,8 @@ class Signal0
void Emit() const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)();
}
@@ -129,7 +130,8 @@ class Signal1
void Emit( Param1 p1 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1 );
}
@@ -193,7 +195,8 @@ class Signal2
void Emit( Param1 p1, Param2 p2 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1, p2 );
}
@@ -259,7 +262,8 @@ class Signal3
void Emit( Param1 p1, Param2 p2, Param3 p3 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1, p2, p3 );
}
@@ -325,7 +329,8 @@ class Signal4
void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1, p2, p3, p4 );
}
@@ -390,7 +395,8 @@ class Signal5
void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1, p2, p3, p4, p5 );
}
@@ -455,7 +461,8 @@ class Signal6
void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1, p2, p3, p4, p5, p6 );
}
@@ -520,7 +527,8 @@ class Signal7
void Emit( Param1 p1, Param2 p2, Param3 p3, Param4 p4, Param5 p5, Param6 p6, Param7 p7 ) const
{
- for (DelegateIterator i = delegateList.begin(); i != delegateList.end(); ++i)
+ DelegateList dl = delegateList;
+ for (DelegateIterator i = dl.begin(); i != dl.end(); ++i)
{
(*i)( p1, p2, p3, p4, p5, p6, p7 );
}
Please sign in to comment.
Something went wrong with that request. Please try again.