Function SDL_SetPointerPropertyWithCleanup

pub unsafe extern "C" fn SDL_SetPointerPropertyWithCleanup(
    props: u32,
    name: *const i8,
    value: *mut c_void,
    cleanup: Option<unsafe extern "C" fn(_: *mut c_void, _: *mut c_void)>,
    userdata: *mut c_void,
) -> bool
Available on crate feature dep_sdl3 only.
Expand description

Set a pointer property in a group of properties with a cleanup function that is called when the property is deleted.

The cleanup function is also called if setting the property fails for any reason.

For simply setting basic data types, like numbers, bools, or strings, use SDL_SetNumberProperty, SDL_SetBooleanProperty, or SDL_SetStringProperty instead, as those functions will handle cleanup on your behalf. This function is only for more complex, custom data.

§Parameters

  • props: the properties to modify.
  • name: the name of the property to modify.
  • value: the new value of the property, or NULL to delete the property.
  • cleanup: the function to call when this property is deleted, or NULL if no cleanup is necessary.
  • userdata: a pointer that is passed to the cleanup function.

§Return value

Returns true on success or false on failure; call SDL_GetError() for more information.

§Thread safety

It is safe to call this function from any thread.

§Availability

This function is available since SDL 3.2.0.

§See also