Some Qt fixes, Windows fixes, and a use-after-free bug