Fix leaking ThumbnailGenerators
The logic for deleting ThumbnailGenerators was kind of broken, so fix
Not sure if this is the right approach, but it doesn't seem racy (and
can't trigger any races), and doesn't leak anymore.
Test Plan: Run with asan and ubsan, open folders with many thumbnails,
Reviewed By: ngraham
Differential Revision: https://phabricator.kde.org/D28346