I have not checked from where this function is called, but this changes the behavior, because it changes the  trackIdList from the caller. Because this is a public function I would prefer to remove this change from the patch. 

You may rewrite the function to use addTracksToCrate(const QList<int>& trackIdList, const int crateId) later.