|
xkbcommon 1.14.0-beta2
Reference library implementing the XKB specification for parsing keyboard descriptions and handling keyboard state
|
Explain how xkbcommon handle object’s ownership.
xkbcommon uses 3 types of ownership:
| Ownership | Allocator | Allocation | References | Examples |
|---|---|---|---|---|
| Exclusive | User | Stack / caller managed | None | |
| xkbcommon | Heap | Exclusive (sole owner) | ||
| Shared | Ref-counted |
@important xkbcommon never takes ownership of caller-allocated memory. In particular, caller-provided buffers and strings are either borrowed for the duration of a function call or internally copied.
xkbcommon objects follow the following transfer rules:
| Mode | Description | Example text |
|---|---|---|
| Call-borrowed | The object is borrowed for the duration of the function call and is not retained after the function returns. The corresponding argument is
|
*(no documentation text for the default argument transfer mode)* |
| Frame-borrowed | The object is borrowed for the lifetime of the corresponding frame and must not be retained. It is stricter than the lifetime of the frame container, as a frame can be overriden or reallocated by the container. The corresponding argument is |
|
| Retained-borrowed | The recipient retains a borrowed pointer to the object without acquiring ownership. The object must remain valid for the entire lifetime of the recipient. The corresponding argument or return is | |
| Owned | Ownership of the object is transferred to the recipient. For a reference-counted type, this means the recipient owns one reference on the value. Such function arguments or return values are never
|
|