Promises are registered upon entry to the pool and
unregistered upon exit. If all promises are in a 'pending' state,
new promises can't be processed. Upon completion of a registered
promise, it is unregistered, allowing space for a new promise.
The code path responsible for unregistering promises when they
resolve runs each time a promise's callback is called.
Unfortunately, there's no guarantee that the callback will be
invoked upon the promise's resolution. For instance, promises
registered with only a 'catch' callback may never be triggered
when the promise resolves correctly.
This commit ensures that a final callback is always registered,
even if the user did not provide one.
This guarantees that promises are always unregistered upon resolution
Fixes: QTBUG-118161
Pick-to: 6.5 6.6 6.7
Change-Id: Ifea93d692464a6ef40c4bcad60f840ca0cb650c9
Reviewed-by: Lorn Potter <lorn.potter@gmail.com>