Skip to content

destroy subscriptions with the destruction of subscribers

This series should improve the debug protocol. Suggested by @pq and @marius.vlad0.

  • 1/4: Merge functions that destroy file and flight-rec subscribers.

    • This is necessary because the functions that creates file and flight-rec subscribers both return weston_log_subscriber, but it was necessary to destroy them with different functions. A user calling the wrong destroy function wouldn't get a warning.

    • In #353 (closed) @pq showed that the best approach to fix this is to expose a single destroy function for destroy the subscribers, what gives no chances for a user to call the wrong function.

  • 2/4: Destroy subscriptions with the destruction of subscribers.

    • Destroying a subscriber and keeping a log scope is a valid use case, but we only had code to destroy subscriptions with the destruction of the related log scope.

    • It's necessary to be able to destroy subscriptions with destruction of subscribers as well, since we can't always depend on the destruction of the log scope.

  • 3/4: Destroy log_context only after the destruction of the subscribers, since they are part of the debug protocol and log_context is "the manager" of it.

    • Until 2/4, we had to destroy the log context (what implies the destruction of scopes) before the subscribers, in order to destroy the subscriptions.

    • This is not necessary anymore. Destroy log context only after the destruction of subscribers.

  • 4/4: Make stream_destroy() use weston_log_subscriber_release() instead of weston_log_subscriber_get_only_subscription() to avoid code duplication.

Fixes: #352 (closed), #353 (closed)

Edited by Leandro Ribeiro

Merge request reports