Skip to content

Fundamentals, Object Lifetime should mention non-parent–child relationships object destruction order #2656

@zopsicle

Description

@zopsicle

Fundamentals, Object Lifetime reads:

Applications can free or destroy objects in any order, except that parent objects must be freed only after all child objects are freed. An object is the parent of another child object if the parent was used as the first object parameter in the creation of the child.

A reader may now conclude that they do not need to worry about destruction order, except for the parent–child relationship. For example, they may conclude that they may destroy an image before destroying an image view created from the image, as the parent–child relationships are device–image and device–image-view.

But there is another exception to the "any order" permission, through Fundamentals, Valid Usage for Object Handles:

Any input parameter to a command that is an object handle must be a valid object handle, unless otherwise specified. An object handle is valid if:

  • Any objects used by that object, either as part of creation or execution, must also be valid.

together with VUID-vkDestroyFooBar-fooBar-parameter, such as for image views:

VUID-vkDestroyImageView-imageView-parameter
If imageView is not VK_NULL_HANDLE, imageView must be a valid VkImageView handle

As such, Fundamentals, Object Lifetime should not suggest any order is allowed, because it is not.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions