gsocket: Fix use-after-close

Merged Ole André Vadla Ravnås requested to merge oleavr/glib:fix/socket-use-after-close into master

To fix (mostly theoretical) race conditions where another thread may have just allocated a new file-descriptor, and we end up using a file-descriptor that doesn't belong to us.

Caught by Application Verifier (on Windows).

Edited by Ole André Vadla Ravnås

Merge request reports