Attempt to fix resurrection of dead objects in KVO signals

In order for a KVO signal to complete immediately after the object has deallocated (and never crash), we basically need to temporarily stave off deallocation if the KVO observation is currently setting up. The only way I could imagine to do that is an explicit lock.

So, this hopefully fixes #1016. I'm not entirely convinced of the theoretical correctness, but it's at least significantly harder to reproduce on my machine.

@epatey