File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
branches/dist-snap/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 @@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
6
6
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
7
7
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8
8
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9
- refs/heads/dist-snap: 962af9198f8f2a1e2d5121ac216b6f4d574ae54c
9
+ refs/heads/dist-snap: f25c81a51a752786ce8936b503c16912478a89fd
10
10
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
11
11
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
12
12
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
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