From 7a0c39a5b46bbb8f2e7b869c642078e892d4804c Mon Sep 17 00:00:00 2001 From: Arthur Hung Date: Wed, 20 Mar 2019 16:52:24 +0800 Subject: Make InputApplicationInfo as a part of InputApplicationHandle (1/2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit InputWindowHandle::updateInfo would also call InputApplicationHandle::updateInfo that may access the null pointer if the focus application changed in same time. - To replace allocated mInfo in updateInfo(), make it as an object   member variable of InputApplicationHandle. Bug: 128930899 Test: atest inputflinger_tests Change-Id: Id19d2d8cd1be181ea994d0efa7afbb2567c4d734 --- libs/input/InputApplication.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'libs/input/InputApplication.cpp') diff --git a/libs/input/InputApplication.cpp b/libs/input/InputApplication.cpp index 7936f50d54..1d9f8a7091 100644 --- a/libs/input/InputApplication.cpp +++ b/libs/input/InputApplication.cpp @@ -24,19 +24,10 @@ namespace android { // --- InputApplicationHandle --- -InputApplicationHandle::InputApplicationHandle() : - mInfo(nullptr) { +InputApplicationHandle::InputApplicationHandle() { } InputApplicationHandle::~InputApplicationHandle() { - delete mInfo; -} - -void InputApplicationHandle::releaseInfo() { - if (mInfo) { - delete mInfo; - mInfo = nullptr; - } } InputApplicationInfo InputApplicationInfo::read(const Parcel& from) { -- cgit v1.2.3-59-g8ed1b