Destroying containers

PR opened again due to me being in retard mode. This PR adds #1014.
Use pointer instead of reference, and call it containerItem. It also can't be const because moving the item changes the parent and destroying it decrements the ref count.