File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -383,16 +383,14 @@ where
383383 // We call this in a separate block so that it runs after the task appears to have
384384 // completed and will still run if the destructor panics.
385385 #[ cfg( tokio_unstable) ]
386- self . trailer ( ) . hooks . with_mut ( |ptr| unsafe {
387- ptr. as_mut ( ) . and_then ( |x| {
388- x. as_mut ( ) . map ( |x| {
389- let _ = panic:: catch_unwind ( panic:: AssertUnwindSafe ( || {
390- x. on_task_terminate ( & mut OnTaskTerminateContext {
391- _phantom : Default :: default ( ) ,
392- } )
393- } ) ) ;
394- } )
395- } )
386+ let _ = with_task_hooks ( |t| {
387+ if let Some ( hooks) = t {
388+ let _ = panic:: catch_unwind ( panic:: AssertUnwindSafe ( || {
389+ hooks. on_task_terminate ( & mut OnTaskTerminateContext {
390+ _phantom : Default :: default ( ) ,
391+ } )
392+ } ) ) ;
393+ }
396394 } ) ;
397395
398396 // The task has completed execution and will no longer be scheduled.
You can’t perform that action at this time.
0 commit comments