From ced8ab2f95695aee05424e9aa206cd59a3f90888 Mon Sep 17 00:00:00 2001 From: "Alexander V. Lukyanov" Date: Mon, 5 Jul 2021 19:59:33 +0300 Subject: [PATCH] fix a null deref on exit --- src/Job.cc | 7 +++++-- src/SMTask.cc | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Job.cc b/src/Job.cc index 63be3fb56..b783eae42 100644 --- a/src/Job.cc +++ b/src/Job.cc @@ -365,12 +365,15 @@ xstring& Job::FormatJobs(xstring& s,int verbose,int indent) void Job::BuryDoneJobs() { - xlist_for_each_safe(Job,all_jobs,node,scan,next) + xarray to_bury; + xlist_for_each(Job,all_jobs,node,scan) { if((scan->parent==this || scan->parent==0) && scan->jobno>=0 && scan->Done()) - scan->DeleteLater(); + to_bury.append(scan); } + for(int i=0; iDeleteLater(); CollectGarbage(); } diff --git a/src/SMTask.cc b/src/SMTask.cc index b8a84e2f9..435ab8c3c 100644 --- a/src/SMTask.cc +++ b/src/SMTask.cc @@ -129,6 +129,7 @@ void SMTask::DeleteLater() { if(deleting) return; + DEBUG(("DeleteLater(%p) from %p\n",this,current)); deleting=true; deleted_tasks.add_tail(deleted_tasks_node); PrepareToDie();