Fixed WIG.OnIdle event bug

A null exception occurs when _onIdle is null.
This commit is contained in:
Ami Bar
2009-12-19 17:43:01 +02:00
parent 760bc5d1a9
commit 5d037fdec8
+1 -1
View File
@@ -325,7 +325,7 @@ namespace Amib.Threading.Internal
_stp.UnregisterWorkItemsGroup(this); _stp.UnregisterWorkItemsGroup(this);
IsIdle = true; IsIdle = true;
_isIdleWaitHandle.Set(); _isIdleWaitHandle.Set();
if (decrementWorkItemsInStpQueue && _onIdle.GetInvocationList().Length > 0) if (decrementWorkItemsInStpQueue && _onIdle != null && _onIdle.GetInvocationList().Length > 0)
{ {
_stp.QueueWorkItem(new WorkItemCallback(FireOnIdle)); _stp.QueueWorkItem(new WorkItemCallback(FireOnIdle));
} }