File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
branches/dist-snap/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 @@ -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: 51c03c1f35f6b076928a1e5b94ec81e6d00c3ac2
9
+ refs/heads/dist-snap: e121d7556cc577c7a89acb3a609fcafcc8fc9204
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 @@ -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