fix: accidental handle copying in a range loop (#43281)
fix: accidental handle copying Xref: https://github.com/electron/electron/pull/37857 Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
a780a75dec
commit
c3a7f0001c
1 changed files with 2 additions and 5 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <utility>
|
||||
|
||||
#include "base/containers/contains.h"
|
||||
#include "base/containers/to_vector.h"
|
||||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "gin/arguments.h"
|
||||
|
@ -242,11 +243,7 @@ std::vector<blink::MessagePortChannel> MessagePort::DisentanglePorts(
|
|||
}
|
||||
|
||||
// Passed-in ports passed validity checks, so we can disentangle them.
|
||||
std::vector<blink::MessagePortChannel> channels;
|
||||
channels.reserve(ports.size());
|
||||
for (auto port : ports)
|
||||
channels.push_back(port->Disentangle());
|
||||
return channels;
|
||||
return base::ToVector(ports, [](auto& port) { return port->Disentangle(); });
|
||||
}
|
||||
|
||||
void MessagePort::Pin() {
|
||||
|
|
Loading…
Reference in a new issue