3649c806a3
Also a few functions segfulted if scene was unlinked, added more checking. First commit from win32, hope line endings are ok.