HomeWildfire Games

Don't execute the task when no Future awaits it anymore

Description

Don't execute the task when no Future awaits it anymore

Summary:
Most of the times the callback stores a reference to a variable in scope where the Future is in. When the scope is left the reference get's dangling. CancelOrWait is called in multiple places (mostly destructors) to ensure the callback isn't executed anymore.
This patch deduplicates thous calls to CancelOrWait.

Refs: #5874

Comments by: @Stan, @vladislavbelov

Differential Revision: https://code.wildfiregames.com/D5208