mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
This fixes two cases where a DeviceLostClosureC might not be consumed before it is dropped, which is a requirement: 1) When the closure is replaced, this ensures the to-be-dropped closure is invoked. 2) When the global is dropped, this ensures that the closure is invoked before it is dropped. The first of these two cases is tested in a new test, DEVICE_LOST_REPLACED_CALLBACK. The second case has a stub, always-skipped test, DROPPED_GLOBAL_THEN_DEVICE_LOST. The test is always-skipped because there does not appear to be a way to drop the global from within a test. Nor is there any other way to reach Device.prepare_to_die without having first dropping the device.