UI Thread .Invoke() causing handle leak?

Posted by JYelton on Stack Overflow See other posts from Stack Overflow or by JYelton
Published on 2010-06-15T19:40:08Z Indexed on 2010/06/15 19:42 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

In what circumstances would updating a UI control from a non-UI thread could cause the processes' handles to continually increase, when using a delegate and .InvokeRequired?

For example:

public delegate void DelegateUIUpdate();
private void UIUpdate()
{
    if (someControl.InvokeRequired)
    {
        someControl.Invoke(new DelegateUIUpdate(UIUpdate));
        return;
    }
    // do something with someControl
}

When this is called in a loop or on timer intervals, the handles for the program consistently increase.

© Stack Overflow or respective owner

Related posts about c#

Related posts about memory-leaks