screen_destroy_stream()

Updated: May 27, 2022

Destroy a stream and free associated resources

Synopsis:

#include <screen/screen.h>
int screen_destroy_stream(screen_stream_t stream)

Arguments:

stream
The handle of the stream to be destroyed. This must have been created with screen_create_stream().

Library:

libscreen

Description:

Function Type: Flushing Execution

This function destroys the stream associated with the given stream handle. Any resources or buffers created for this stream, both locally and by the windowing system, are released.

The stream handle can no longer be used as an argument to subsequent Screen API calls. Buffers that aren't created by Screen and registered with screen_attach_stream_buffers() aren't freed by this operation.

The buffers aren't freed until all shared users of the buffers have also called screen_destroy_stream() or screen_destroy_stream_buffers().

Your application is responsible for releasing its own external buffers. You must use screen_destroy_stream() to free streams that were obtained by querying context or event properties because Screen doesn't remove the streams if they still exist. Screen releases only the local state associated with external streams.

Returns:

0 if successful, or -1 if an error occurred (errno is set; refer to errno.h for more details).