Thanks. I can see how that might occur. It can happen if you choose to display PDF files in the gallery that are not actually linked to any record in your tree, something I recall you do.
I will transfer this query to the bug list and respond to it there.