File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
branches/try/src/librustuv Expand file tree Collapse file tree 2 files changed +8
-4
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: 51c03c1f35f6b076928a1e5b94ec81e6d00c3ac2
5
+ refs/heads/try: e121d7556cc577c7a89acb3a609fcafcc8fc9204
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 @@ -57,14 +57,18 @@ impl UvEventLoop {
57
57
UvEventLoop {
58
58
uvio : UvIoFactory {
59
59
loop_ : loop_,
60
- handle_pool : handle_pool,
60
+ handle_pool : Some ( handle_pool) ,
61
61
}
62
62
}
63
63
}
64
64
}
65
65
66
66
impl Drop for UvEventLoop {
67
67
fn drop ( & mut self ) {
68
+ // Must first destroy the pool of handles before we destroy the loop
69
+ // because otherwise the contained async handle will be destroyed after
70
+ // the loop is free'd (use-after-free)
71
+ self . uvio . handle_pool . take ( ) ;
68
72
self . uvio . loop_ . close ( ) ;
69
73
}
70
74
}
@@ -117,14 +121,14 @@ fn test_callback_run_once() {
117
121
118
122
pub struct UvIoFactory {
119
123
loop_ : Loop ,
120
- priv handle_pool : ~QueuePool ,
124
+ priv handle_pool : Option < ~QueuePool > ,
121
125
}
122
126
123
127
impl UvIoFactory {
124
128
pub fn uv_loop < ' a > ( & mut self ) -> * uvll:: uv_loop_t { self . loop_ . handle }
125
129
126
130
pub fn make_handle ( & mut self ) -> HomeHandle {
127
- HomeHandle :: new ( self . id ( ) , & mut * self . handle_pool )
131
+ HomeHandle :: new ( self . id ( ) , & mut * * self . handle_pool . get_mut_ref ( ) )
128
132
}
129
133
}
130
134
You can’t perform that action at this time.
0 commit comments