This project has moved. For the latest updates, please go here.

Potential improvement to event code

Sep 16, 2013 at 9:19 AM
Possibly a minor point, but the event firing could be more thread-safe by copying the handler to a local variable and then firing the local variable. This prevents potential issues where while the task is firing a separate thread adds or removes more handlers before the event is complete. It's an edge case, but as nobody can know how this control may be used anything is possible.

For example, OnTaskMouseDoubleClick would look like:
private void OnTaskMouseDoubleClick(TaskMouseEventArgs e)
    EventHandler<TaskMouseEventArgs> locum = TaskMouseDoubleClick;

    if (locum != null)
        locum(this, e);