49 lines
1.7 KiB
Diff
49 lines
1.7 KiB
Diff
From 91164da48032b078783defaa3cf1f1e173525af0 Mon Sep 17 00:00:00 2001
|
|
From: Wim Taymans <wtaymans@redhat.com>
|
|
Date: Mon, 1 Sep 2014 13:12:27 +0200
|
|
Subject: [PATCH 2/3] bluez5-util: add dispose function
|
|
|
|
Add a dispose function to the transport that is called before freeing
|
|
the transport. Useful for cleaning up extra userdata.
|
|
---
|
|
src/modules/bluetooth/bluez5-util.c | 2 ++
|
|
src/modules/bluetooth/bluez5-util.h | 2 ++
|
|
2 files changed, 4 insertions(+)
|
|
|
|
diff --git a/src/modules/bluetooth/bluez5-util.c b/src/modules/bluetooth/bluez5-util.c
|
|
index 1ee2f33..50f977e 100644
|
|
--- a/src/modules/bluetooth/bluez5-util.c
|
|
+++ b/src/modules/bluetooth/bluez5-util.c
|
|
@@ -205,6 +205,8 @@ void pa_bluetooth_transport_unlink(pa_bluetooth_transport *t) {
|
|
void pa_bluetooth_transport_free(pa_bluetooth_transport *t) {
|
|
pa_assert(t);
|
|
|
|
+ if (t->dispose)
|
|
+ t->dispose (t);
|
|
pa_bluetooth_transport_unlink(t);
|
|
|
|
pa_xfree(t->owner);
|
|
diff --git a/src/modules/bluetooth/bluez5-util.h b/src/modules/bluetooth/bluez5-util.h
|
|
index 8db4a17..fde2e78 100644
|
|
--- a/src/modules/bluetooth/bluez5-util.h
|
|
+++ b/src/modules/bluetooth/bluez5-util.h
|
|
@@ -60,6 +60,7 @@ typedef enum pa_bluetooth_transport_state {
|
|
|
|
typedef int (*pa_bluetooth_transport_acquire_cb)(pa_bluetooth_transport *t, bool optional, size_t *imtu, size_t *omtu);
|
|
typedef void (*pa_bluetooth_transport_release_cb)(pa_bluetooth_transport *t);
|
|
+typedef void (*pa_bluetooth_transport_dispose_cb)(pa_bluetooth_transport *t);
|
|
|
|
struct pa_bluetooth_transport {
|
|
pa_bluetooth_device *device;
|
|
@@ -76,6 +77,7 @@ struct pa_bluetooth_transport {
|
|
|
|
pa_bluetooth_transport_acquire_cb acquire;
|
|
pa_bluetooth_transport_release_cb release;
|
|
+ pa_bluetooth_transport_dispose_cb dispose;
|
|
void *userdata;
|
|
};
|
|
|
|
--
|
|
2.1.0
|
|
|