The onFinalize() callback could be called more than once, which is not ok

This commit is contained in:
Emiel Bruijntjes 2020-04-18 16:50:14 +02:00
parent 79fe85cc0b
commit 31e4a8596c
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}