mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-07 13:30:09 -05:00
spa: bluez: add cancel_and_unref() dbus helper
This function cancels and unrefs a DBusPendingCall and resets the pointer to NULL.
This commit is contained in:
parent
1025d5c600
commit
183270f53c
4 changed files with 39 additions and 53 deletions
22
spa/plugins/bluez5/dbus-helpers.h
Normal file
22
spa/plugins/bluez5/dbus-helpers.h
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* Spa Bluez5 DBus helpers */
|
||||
/* SPDX-FileCopyrightText: Copyright © 2023 PipeWire authors */
|
||||
/* SPDX-License-Identifier: MIT */
|
||||
|
||||
#ifndef SPA_BLUEZ5_DBUS_HELPERS_H
|
||||
#define SPA_BLUEZ5_DBUS_HELPERS_H
|
||||
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#include <spa/utils/cleanup.h>
|
||||
|
||||
static inline void cancel_and_unref(DBusPendingCall **pp)
|
||||
{
|
||||
DBusPendingCall *pending_call = spa_steal_ptr(*pp);
|
||||
|
||||
if (pending_call) {
|
||||
dbus_pending_call_cancel(pending_call);
|
||||
dbus_pending_call_unref(pending_call);
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* SPA_BLUEZ5_DBUS_HELPERS_H */
|
||||
Loading…
Add table
Add a link
Reference in a new issue