autocacher: re-copy list before waiting

This commit is contained in:
itsmattkc
2021-04-08 22:57:09 +10:00
parent 11548b3a74
commit e037db2f77
+4
View File
@@ -386,6 +386,10 @@ void PreviewAutoCacher::ClearVideoQueue(bool wait)
watcher->Cancel();
}
if (wait) {
// Re-copy because the above cancels may have deleted these watchers
vt_copy = video_tasks_;
sft_copy = single_frame_tasks_;
for (auto it=vt_copy.cbegin(); it!=vt_copy.cend(); it++) {
it.key()->WaitForFinished();
}