Fix retain cycles under ARC

There were a lot of retain cycles that were causing leaks (even preventing
the window classes from releasing, thus leaving hidden windows around).

I spent some time with Instruments analyzing leaks and the retain/release histories
of leaked objects, then analyzed all of the pointers cached around in the
classes, and I think I've now finally got all the retains properly handled.
Basically any child must hold a __weak reference to a parent object or
just an object owned by some other class/instance.