File tree Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Expand file tree Collapse file tree 1 file changed +2
-4
lines changed Original file line number Diff line number Diff line change @@ -94,12 +94,10 @@ unsafe fn get_task_local_map(task: *rust_task) -> TaskLocalMap {
94
94
let map_ptr = rt:: rust_get_task_local_data ( task) ;
95
95
if map_ptr. is_null ( ) {
96
96
let map: TaskLocalMap = @mut ~[ ] ;
97
+ // NB: This bumps the ref count before converting to an unsafe pointer,
98
+ // keeping the map alive until TLS is destroyed
97
99
rt:: rust_set_task_local_data ( task, cast:: transmute ( map) ) ;
98
100
rt:: rust_task_local_data_atexit ( task, cleanup_task_local_map_extern_cb) ;
99
- // Also need to reference it an extra time to keep it for now.
100
- let nonmut = cast:: transmute :: < TaskLocalMap ,
101
- @~[ Option < TaskLocalElement > ] > ( map) ;
102
- cast:: bump_box_refcount ( nonmut) ;
103
101
map
104
102
} else {
105
103
let map = cast:: transmute ( map_ptr) ;
You can’t perform that action at this time.
0 commit comments