Fix missing detached flag in Process::Handle moves

This is why C++'s move semantics are footguns. The result of this was
that grouped plugins would no longer be detached when they were
moved (in this case, into the group connect handler closure). Which in
turn caused those plugins to block until the plugin host process
terminated, which thus ended up blocking the host indefinitely.
This commit is contained in:
Robbert van der Helm
2023-02-21 15:01:01 +01:00
parent 4ea0530a37
commit ee971f610e
2 changed files with 7 additions and 1 deletions
+3 -1
View File
@@ -194,13 +194,15 @@ Process::Handle::~Handle() {
}
}
Process::Handle::Handle(Handle&& o) noexcept : pid_(o.pid_) {
Process::Handle::Handle(Handle&& o) noexcept
: detached_(o.detached_), pid_(o.pid_) {
o.detached_ = true;
}
Process::Handle& Process::Handle::operator=(Handle&& o) noexcept {
o.detached_ = true;
detached_ = o.detached_;
pid_ = o.pid_;
return *this;