fix(library/task_queue): do not keep references to cancelled task_results in the exception
We store this exception in the task_result itself, which creates a reference cycle.
This commit is contained in:
parent
d454cc8bcd
commit
9b97dc73dc
2 changed files with 1 additions and 5 deletions
|
|
@ -72,8 +72,7 @@ task_queue & get_global_task_queue() {
|
|||
return *g_tq;
|
||||
}
|
||||
|
||||
task_cancellation_exception::task_cancellation_exception(generic_task_result const & cancelled_task) :
|
||||
m_cancelled_task(cancelled_task) {
|
||||
task_cancellation_exception::task_cancellation_exception(generic_task_result const & cancelled_task) {
|
||||
std::ostringstream out;
|
||||
if (cancelled_task) {
|
||||
out << "task cancelled: " << cancelled_task.description();
|
||||
|
|
|
|||
|
|
@ -212,14 +212,11 @@ task_result<T> mk_pure_task_result(T const & t, std::string const & desc) {
|
|||
}
|
||||
|
||||
class task_cancellation_exception : public std::exception {
|
||||
generic_task_result m_cancelled_task;
|
||||
std::string m_msg;
|
||||
public:
|
||||
task_cancellation_exception() : task_cancellation_exception(generic_task_result()) {}
|
||||
task_cancellation_exception(generic_task_result const & cancelled_task);
|
||||
char const * what() const noexcept override;
|
||||
|
||||
generic_task_result get_cancelled_task() const { return m_cancelled_task; }
|
||||
};
|
||||
|
||||
class task_queue {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue