Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resource: take a ref from iter to res only if res fully initialized
The sid_resource_iter_create normally takes a reference to the resource. However, we cannot take the ref if we are creating the iterator inside resource's 'create' callback in which case we're actually creating an iterator that is internal to the resource,. Such iterator would need to be destroyed in resource's 'destroy' callback (causing the resource to be unreffed). We would never get to that because the 'destroy' callback is called only after the ref_count hits 0. Currently, the only resource API function that takes a ref is the sid_resource_iter_create, but the same would apply for any other API function that could be called inside resource's create callback.
- Loading branch information