diff Implab/PromiseT.cs @ 130:671f60cd0250 v2

fixed Resove method bug when calling it on already cancelled promise
author cin
date Fri, 30 Jan 2015 17:07:17 +0300
parents 2573b562e328
children 656815cb7147
line wrap: on
line diff
--- a/Implab/PromiseT.cs	Thu Jan 29 18:31:06 2015 +0300
+++ b/Implab/PromiseT.cs	Fri Jan 30 17:07:17 2015 +0300
@@ -302,9 +302,10 @@
         T m_result;
 
         public virtual void Resolve(T value) {
-            BeginSetResult();
-            m_result = value;
-            EndSetResult();
+            if (BeginSetResult()) {
+                m_result = value;
+                EndSetResult();
+            }
         }
 
         public void Reject(Exception error) {