Skip to content

Commit 8c72154

Browse files
committed
---
yaml --- r: 94523 b: refs/heads/try c: f25c81a h: refs/heads/master i: 94521: 5f3862a 94519: f1b4220 v: v3
1 parent a3d0545 commit 8c72154

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5-
refs/heads/try: 962af9198f8f2a1e2d5121ac216b6f4d574ae54c
5+
refs/heads/try: f25c81a51a752786ce8936b503c16912478a89fd
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/librustuv/queue.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ impl QueuePool {
138138
}
139139
Queue { queue: self.producer.clone() }
140140
}
141+
142+
pub fn handle(&self) -> *uvll::uv_async_t {
143+
unsafe { (*self.producer.packet()).handle }
144+
}
141145
}
142146

143147
impl Queue {
@@ -180,7 +184,9 @@ impl Drop for State {
180184
fn drop(&mut self) {
181185
unsafe {
182186
uvll::uv_close(self.handle, cast::transmute(0));
183-
uvll::free_handle(self.handle);
187+
// Note that this does *not* free the handle, that is the
188+
// responsibility of the caller because the uv loop must be closed
189+
// before we deallocate this uv handle.
184190
}
185191
}
186192
}

branches/try/src/librustuv/uvio.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,13 @@ impl Drop for UvEventLoop {
6767
fn drop(&mut self) {
6868
// Must first destroy the pool of handles before we destroy the loop
6969
// because otherwise the contained async handle will be destroyed after
70-
// the loop is free'd (use-after-free)
70+
// the loop is free'd (use-after-free). We also must free the uv handle
71+
// after the loop has been closed because during the closing of the loop
72+
// the handle is required to be used apparently.
73+
let handle = self.uvio.handle_pool.get_ref().handle();
7174
self.uvio.handle_pool.take();
7275
self.uvio.loop_.close();
76+
unsafe { uvll::free_handle(handle) }
7377
}
7478
}
7579

0 commit comments

Comments
 (0)