From e5f2189f9ca55fc7da91f5c5947c0dcc114b2090 Mon Sep 17 00:00:00 2001 From: Rheygine Medel Date: Mon, 10 Aug 2020 13:42:52 -0700 Subject: [PATCH] display: Add a check when registering a client This change checks if the registered client has a valid callback and hwc session. Change-Id: I9758d6d59c7087e67e89318746cb48054255ab72 CRs-Fixed: 2749805 --- services/config/src/device_impl.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/services/config/src/device_impl.cpp b/services/config/src/device_impl.cpp index 74801947..b88e1c5e 100644 --- a/services/config/src/device_impl.cpp +++ b/services/config/src/device_impl.cpp @@ -75,7 +75,13 @@ Return DeviceImpl::registerClient(const hidl_string &client_name, callback->linkToDeath(this, client_handle); } ConfigInterface *intf = nullptr; - intf_->RegisterClientContext(device_client, &intf); + error = intf_->RegisterClientContext(device_client, &intf); + + if (error) { + callback->unlinkToDeath(this); + return Void(); + } + device_client->SetDeviceConfigIntf(intf); display_config_map_.emplace(std::make_pair(client_handle, device_client));