Skip to content

Commit f15590e

Browse files
committed
use weakptr to be on the safe side
1 parent 513bfb8 commit f15590e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/Storages/MergeTree/ExportPartTask.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,15 @@ bool ExportPartTask::executeStep()
187187
The simples way is this one, and given the release timeline, I am opting for it.
188188
*/
189189
(*exports_list_entry)->thread_group->setCancelPredicate(
190-
[this]() -> bool { return isCancelled(); });
190+
[weak_this = weak_from_this()]() -> bool
191+
{
192+
if (auto shared_this = weak_this.lock())
193+
{
194+
return shared_this->isCancelled();
195+
}
196+
197+
return true;
198+
});
191199

192200
SinkToStoragePtr sink;
193201

src/Storages/MergeTree/ExportPartTask.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace DB
88
{
99

10-
class ExportPartTask : public IExecutableTask
10+
class ExportPartTask : public IExecutableTask, public std::enable_shared_from_this<ExportPartTask>
1111
{
1212
public:
1313
explicit ExportPartTask(

0 commit comments

Comments
 (0)