Fix memory leak in tree-view (Issue #573)

And add documentation to the relevant method.

Co-authored-by: Alexander Schwinn <alexxcons@xfce.org>
2 jobs for master in 7 minutes and 3 seconds (queued for 1 second)