Index: ipc/attachment_broker_unprivileged_mac.cc |
diff --git a/ipc/attachment_broker_unprivileged_mac.cc b/ipc/attachment_broker_unprivileged_mac.cc |
index b4ced08048511f597f60b46f0885d584a47b722c..65d26f245b01d8fb19ea655d3117992ea4693765 100644 |
--- a/ipc/attachment_broker_unprivileged_mac.cc |
+++ b/ipc/attachment_broker_unprivileged_mac.cc |
@@ -50,16 +50,19 @@ AttachmentBrokerUnprivilegedMac::AttachmentBrokerUnprivilegedMac() {} |
AttachmentBrokerUnprivilegedMac::~AttachmentBrokerUnprivilegedMac() {} |
bool AttachmentBrokerUnprivilegedMac::SendAttachmentToProcess( |
- const BrokerableAttachment* attachment, |
+ BrokerableAttachment* attachment, |
base::ProcessId destination_process) { |
switch (attachment->GetBrokerableType()) { |
case BrokerableAttachment::MACH_PORT: { |
- const internal::MachPortAttachmentMac* mach_port_attachment = |
- static_cast<const internal::MachPortAttachmentMac*>(attachment); |
+ internal::MachPortAttachmentMac* mach_port_attachment = |
+ static_cast<internal::MachPortAttachmentMac*>(attachment); |
internal::MachPortAttachmentMac::WireFormat format = |
mach_port_attachment->GetWireFormat(destination_process); |
- return get_sender()->Send( |
- new AttachmentBrokerMsg_DuplicateMachPort(format)); |
+ bool success = |
+ get_sender()->Send(new AttachmentBrokerMsg_DuplicateMachPort(format)); |
+ if (success) |
+ mach_port_attachment->reset_mach_port_ownership(); |
+ return success; |
} |
default: |
NOTREACHED(); |