Another option is to use boost::shared_ptr<CThumbLoader> here - that way you can get rid of the cleanup() routine as the thumbloaders will automatically be removed when the job is deconstructed.