Merge pull request #4937 from apple/anoyes/allow-flow-lock-kill-to-delete-self
Allow FlowLock::kill to delete self
This commit is contained in:
commit
82a9bdbbaf
|
@ -1348,7 +1348,9 @@ struct FlowLock : NonCopyable, public ReferenceCounted<FlowLock> {
|
|||
// Only works if broken_on_destruct.canBeSet()
|
||||
void kill(Error e = broken_promise()) {
|
||||
if (broken_on_destruct.canBeSet()) {
|
||||
broken_on_destruct.sendError(e);
|
||||
auto local = broken_on_destruct;
|
||||
// It could be the case that calling broken_on_destruct destroys this FlowLock
|
||||
local.sendError(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue