This is the vala-friendly way of handling GPtrArray. Fix several memory leaks on the go and unnecessary reference increase.