Said method can out-live the factory instance. This was not a problem because the method takes care to keep all its need from `this` alive, by copying them to the coroutine stack. However, this fact that this method can out-live the instance is not obvious, and an unsuspecting developer (me) added a new member (_logger) which was not kept alive. This can cause a use-after-free in the factory. Fix by making initialize() static, forcing the instance to pass all parameters explicitely and add a comment explaining that this method can out-live the instance.
2.7 KiB
2.7 KiB