Since killing a task involves unlinking it, all other tasks scheduked must have been killed/unlinked.
If not you will touching freed memory.
@@ -47,7 +47,9 @@ public:
_gate() {
ScheduleNow();
}
- ~SyncTask() override = default;
+ ~SyncTask() override {
+ Kill();
+ }
void await() {
_gate.await();
@@ -67,6 +69,9 @@ struct TargetPoolTask : public FNET_Task {
{
ScheduleNow();
}
+ ~TargetPoolTask() override {
+ Kill();
+ }
void PerformTask() override {
_pool.flushTargets(false);
Schedule(1.0);
