Revert "Fix crash issue when destroying notify io" 47/311447/2 accepted/tizen/7.0/unified/20240524.012250
authorWootak Jung <wootak.jung@samsung.com>
Tue, 21 May 2024 08:18:59 +0000 (17:18 +0900)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 23 May 2024 02:49:36 +0000 (02:49 +0000)
This reverts commit 50734b06177e2160c3309dfc3aad3aed9b766e39.

Change-Id: I1f0a72a0806df969ff011151e278af09c213164d

src/gatt-client.c

index 8341a3100a5e7b8a103a1bd029fea496fef12392..977926af572fed6d1a137305c1405e35ebb2bf16 100644 (file)
@@ -1734,6 +1734,12 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        if (!client)
                return btd_error_failed(msg, "Failed allocate notify session");
 
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+       chrc->notify_io = new0(struct sock_io, 1);
+       chrc->notify_io->data = client;
+       chrc->notify_io->msg = dbus_message_ref(msg);
+       chrc->notify_io->destroy = notify_io_destroy;
+#endif
        client->notify_id = bt_gatt_client_register_notify(gatt,
                                                chrc->value_handle,
                                                register_notify_io_cb,
@@ -1741,6 +1747,11 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
                                                client, NULL);
        if (!client->notify_id) {
                notify_client_unref(client);
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+               dbus_message_unref(chrc->notify_io->msg);
+               g_free(chrc->notify_io);
+               chrc->notify_io = NULL;
+#endif
                return btd_error_failed(msg, "Failed to subscribe");
        }
 
@@ -1750,10 +1761,12 @@ static DBusMessage *characteristic_acquire_notify(DBusConnection *conn,
        DBG("Added client to notify_clients. length: %d", queue_length(chrc->notify_clients));
 #endif
 
+#ifndef TIZEN_FEATURE_BLUEZ_MODIFY
        chrc->notify_io = new0(struct sock_io, 1);
        chrc->notify_io->data = client;
        chrc->notify_io->msg = dbus_message_ref(msg);
        chrc->notify_io->destroy = notify_io_destroy;
+#endif
 
        return NULL;
 }