Do not apply constraints again until the previous operation finished
"applyConstraints" is asynchronous, so calling it several times in a row
tried to apply the constraints again while the constraints for the
previous quality were still being applied. Due to this the constraints
for the same quality could be applied several times. Now applying
further constraints is deferred and collapsed in a single operation
until the previous operation finished.
When several different qualities are deferred there is no need to apply
the full sequence of deferred qualities; only the last quality is
applied, as qualities do not depend on previous qualities and the last
applied quality will always override any other quality previously
applied.
Note that, in general, "applyConstraints(quality)" is not expected to be
called again while the previous constraints are still being applied, so
deferring further calls should rarely happen. However, in practice this
could happen due to bugs in other parts of the code, so it is safer to
guard against it.
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Loading
Please register or sign in to comment