File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
branches/try/src/librustuv Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 2
2
refs/heads/master: 0da105a8b7b6b1e0568e8ff20f6ff4b13cc7ecc2
3
3
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4
4
refs/heads/snap-stage3: a6d3e57dca68fde4effdda3e4ae2887aa535fcd6
5
- refs/heads/try: 962af9198f8f2a1e2d5121ac216b6f4d574ae54c
5
+ refs/heads/try: f25c81a51a752786ce8936b503c16912478a89fd
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
Original file line number Diff line number Diff line change @@ -138,6 +138,10 @@ impl QueuePool {
138
138
}
139
139
Queue { queue : self . producer . clone ( ) }
140
140
}
141
+
142
+ pub fn handle ( & self ) -> * uvll:: uv_async_t {
143
+ unsafe { ( * self . producer . packet ( ) ) . handle }
144
+ }
141
145
}
142
146
143
147
impl Queue {
@@ -180,7 +184,9 @@ impl Drop for State {
180
184
fn drop ( & mut self ) {
181
185
unsafe {
182
186
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.
184
190
}
185
191
}
186
192
}
Original file line number Diff line number Diff line change @@ -67,9 +67,13 @@ impl Drop for UvEventLoop {
67
67
fn drop ( & mut self ) {
68
68
// Must first destroy the pool of handles before we destroy the loop
69
69
// 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 ( ) ;
71
74
self . uvio . handle_pool . take ( ) ;
72
75
self . uvio . loop_ . close ( ) ;
76
+ unsafe { uvll:: free_handle ( handle) }
73
77
}
74
78
}
75
79
You can’t perform that action at this time.
0 commit comments