Skip to content

Commit 5447ae7

Browse files
committed
---
yaml --- r: 96935 b: refs/heads/dist-snap c: f25c81a h: refs/heads/master i: 96933: b67650e 96931: 21972b7 96927: 324d241 v: v3
1 parent 0e9b22e commit 5447ae7

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
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 962af9198f8f2a1e2d5121ac216b6f4d574ae54c
9+
refs/heads/dist-snap: f25c81a51a752786ce8936b503c16912478a89fd
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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)