The onFinalize() callback could be called more than once, which is not ok
This commit is contained in:
parent
79fe85cc0b
commit
31e4a8596c
|
|
@ -290,12 +290,12 @@ public:
|
|||
*/
|
||||
Deferred &onFinalize(const FinalizeCallback &callback)
|
||||
{
|
||||
// store callback
|
||||
_finalizeCallback = callback;
|
||||
|
||||
// if the object is already in a failed state, we call the callback right away
|
||||
if (_failed) callback();
|
||||
|
||||
// otherwise we store callback until it's time for the call
|
||||
else _finalizeCallback = callback;
|
||||
|
||||
// allow chaining
|
||||
return *this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue