Rework object locking

This PR reworks the object locking.

It

* Adds note why locking is not required in some cases
* Adds locking where it is missing
* Adds ref counting where it is missing

This is **WIP**, the following modules are on my todo-list:

- [X] `src/objects/`
- [ ] `src/compositor/`
- [x] `src/action`
- [x] `src/serialize`
- [x] `src/values`

Feel free to propose more, participate in this PR (just notify me which stuff
you want to do) or the like!
This was done in the last push, the diff is outdated.