summaryrefslogtreecommitdiffstats
path: root/base/mac/scoped_mach_port.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/mac/scoped_mach_port.cc')
-rw-r--r--base/mac/scoped_mach_port.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/base/mac/scoped_mach_port.cc b/base/mac/scoped_mach_port.cc
index 652e3f4..9e45a85 100644
--- a/base/mac/scoped_mach_port.cc
+++ b/base/mac/scoped_mach_port.cc
@@ -11,9 +11,14 @@ ScopedMachPort::ScopedMachPort(mach_port_t port) : port_(port) {
}
ScopedMachPort::~ScopedMachPort() {
+ reset();
+}
+
+void ScopedMachPort::reset(mach_port_t port) {
if (port_ != MACH_PORT_NULL) {
mach_port_deallocate(mach_task_self(), port_);
}
+ port_ = port;
}
} // namespace mac