Changeset 166 for cpp/frams


Ignore:
Timestamp:
03/11/14 14:38:47 (10 years ago)
Author:
sz
Message:

Iterating a copy of callback list allows to modify the original while iterating it (still not safe in general, but it is good enough for the most common case of self-unregistration)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpp/frams/util/callbacks.cpp

    r121 r166  
    6363void Callback::action(long data)
    6464{
    65 FOREACH(CallbackNode*,n,(*this))
     65if (size()==0) return;
     66SList copy=*this;
     67FOREACH(CallbackNode*,n,copy)
    6668        n->action(data);
    6769}
Note: See TracChangeset for help on using the changeset viewer.