Diff between a3396702362776ca21bbf06686626c7f0bb39d28 and 29b7375f5e6f63202b6186bd0e34e0ca925a4910

Changed Files

File Additions Deletions Status
src/manager.c +2 -0 modified
src/profile.c +20 -0 modified
src/profile.h +2 -0 modified

Full Patch

diff --git a/src/manager.c b/src/manager.c
index 90e6e6b..f1f0f4d 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -291,6 +291,8 @@ void manager_cleanup(const char *path)
 		btd_adapter_unref(adapter);
 	}
 
+	btd_profile_cleanup();
+
 	btd_start_exit_timer();
 
 	g_dbus_unregister_interface(btd_get_dbus_connection(),
diff --git a/src/profile.c b/src/profile.c
index aa76a91..fa1b0a0 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -27,12 +27,16 @@
 
 #include <stdbool.h>
 #include <stdint.h>
+#include <errno.h>
 
 #include <glib.h>
 #include <dbus/dbus.h>
+#include <gdbus.h>
 
 #include "uuid.h"
+#include "log.h"
 #include "error.h"
+#include "dbus-common.h"
 #include "adapter.h"
 #include "device.h"
 #include "profile.h"
@@ -186,3 +190,19 @@ DBusMessage *btd_profile_unreg_ext(DBusConnection *conn, DBusMessage *msg,
 
 	return dbus_message_new_method_return(msg);
 }
+
+void btd_profile_cleanup(void)
+{
+	while (ext_profiles) {
+		struct ext_profile *ext = ext_profiles->data;
+		DBusMessage *msg;
+
+		msg = dbus_message_new_method_call(ext->owner, ext->path,
+							"org.bluez.Profile",
+							"Release");
+		if (msg)
+			g_dbus_send_message(btd_get_dbus_connection(), msg);
+
+		remove_ext(ext);
+	}
+}
diff --git a/src/profile.h b/src/profile.h
index 12d2b3e..1702901 100644
--- a/src/profile.h
+++ b/src/profile.h
@@ -57,6 +57,8 @@ void btd_profile_foreach(void (*func)(struct btd_profile *p, void *data),
 int btd_profile_register(struct btd_profile *profile);
 void btd_profile_unregister(struct btd_profile *profile);
 
+void btd_profile_cleanup(void);
+
 DBusMessage *btd_profile_reg_ext(DBusConnection *conn, DBusMessage *msg,
 							void *user_data);
 DBusMessage *btd_profile_unreg_ext(DBusConnection *conn, DBusMessage *msg,