gobject: Cleanup GWeakRef locations on object finalization
It can happen that a GWeakRef is added to an object while it's disposing (or even during finalizing) and this may happen in a thread that (weak) references an object while the disposal isn't completed yet or when using toggle references and switching to GWeakRef on notification (as the API suggests).
In such scenario the weak locations are not cleaned up when the object is finalized, and will point to a free'd area.
So, just after finalization and when we're sure that the object will be destroyed for sure, check again if there are new weak locations and unset them if any, as part of the qdata destruction.
Added various tests simulating this case.
Fixes: #2390 (closed)