GeneratorObjects: Fix potential race. See merge request !46528
mentioned in commit bfd26e53
mentioned in commit 4abfb9ef