From 093ad18196bc055d260aeb38b38a6551283b77c9 Mon Sep 17 00:00:00 2001 From: Denis Corbin Date: Wed, 4 Dec 2024 15:31:35 +0100 Subject: [PATCH] fixing bug in thread_cancellation class when destroying a thread_cancellation object on a thread which was requested to be cancelled, the status was kept forever in the preborn list, which purpose is not for that but to record cancellation for thread which no thread_cancellation object was yet run. just deleting thread_cancellation reference from the info list is better, the cancellation information for that tid will be forgotten once all thread_cancellation object for that thread will be deleted. --- src/build/ChangeLog | 4 +++- src/libdar/thread_cancellation.cpp | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/build/ChangeLog b/src/build/ChangeLog index a9d19827..170d637b 100644 --- a/src/build/ChangeLog +++ b/src/build/ChangeLog @@ -12,7 +12,9 @@ from 2.7.15 to 2.7.16 more than the half of kept entries... - adding kdf support for repairing operation instead of using the values of the archive/backup under reparation. - +- fixing bug in thread_cancellation class that led a cancelled thread kept + being recorded as cancelled forever, leading libdar to abort immediately when + run in a new thread having the the same tid. from 2.7.14 to 2.7.15 - updating libdar about CURLINFO_CONTENT_LENGTH_DOWNLOAD symbol which is diff --git a/src/libdar/thread_cancellation.cpp b/src/libdar/thread_cancellation.cpp index f3d228ec..d3b2edde 100644 --- a/src/libdar/thread_cancellation.cpp +++ b/src/libdar/thread_cancellation.cpp @@ -81,7 +81,7 @@ namespace libdar status.cancellation = false; status.flag = 0; } - else // pending cancellation for that thread + else // pending cancellation information for that thread { status = *it; preborn.erase(it); @@ -118,11 +118,7 @@ namespace libdar if(*ptr == nullptr) bug = true; else - { - if((*ptr)->status.cancellation) // cancellation for that thread - preborn.push_back((*ptr)->status); info.erase(ptr); - } CRITICAL_END; if(bug)