If the surface is part of a texture it doesn't keep its own reference to the device, but instead relies on the reference the texture has. This fixes a regression introduced by 3cedef2ffe.
3cedef2ffe