Alfredo Braunstein wrote:

> I've added the explanation in a comment.
> 
> --- forkedcontr.C       2003/02/13 16:53:14     1.7
> +++ forkedcontr.C       2003/02/25 10:26:02
> @@ -130,19 +130,19 @@
>                 }
> 
>                 if (remove_it) {
> -                       // Emit signal and remove the item from the list
> -                       actCall->emitSignal();
> -                       delete actCall;
>                         // erase returns the next iterator, so decrement
>                         it // to continue the loop.
> -                       ListType::iterator prev = it;
> -                       --prev;
>                         forkedCalls.erase(it);
> -                       it = prev;
> +                       // Emit signal and remove the item from the list
> +                       actCall->emitSignal();
> +                       delete actCall;
> +                       /* start all over: emiting the signal can result
> +                        * in changing the list (Ab)
> +                        */
> +                       it = forkedCalls.begin();
>                 }
>         }

I don't see the bug. You return to the start of the list, I move to the next 
itme in the list. The 'prev' stuff is safe if ugly, as I understand list.

Please improve my education.

> -
> -       if (!forkedCalls.empty()) {
> +       if (!forkedCalls.empty() && !timeout_->running()) {
>                 timeout_->start();
>         }

Fair enough. I'll commit this bit.

-- 
Angus

Reply via email to