Fixes to particle deadlock, and some other crashes

recent changes to when we lock() were incorrect. I've taken a pass at cleaning this up.

Biggest change is to make the QReadWriteLock recursive, and to move the default locking into the Octree class so callers need not know when to lock unless they want to try to create a transaction around multiple operations.