Check if WindowInfosListener is present during remove
This reverts commit 4854af5fa5c713ddfefad8770b3cb9e7ae0a494f.
Bug: 263311858
Test: presubmits
Change-Id: I1e53499745117fce80435fdf40e66efc55147bf9
diff --git a/libs/gui/WindowInfosListenerReporter.cpp b/libs/gui/WindowInfosListenerReporter.cpp
index 01e865d..2b34a0f 100644
--- a/libs/gui/WindowInfosListenerReporter.cpp
+++ b/libs/gui/WindowInfosListenerReporter.cpp
@@ -62,6 +62,10 @@
status_t status = OK;
{
std::scoped_lock lock(mListenersMutex);
+ if (mWindowInfosListeners.find(windowInfosListener) == mWindowInfosListeners.end()) {
+ return status;
+ }
+
if (mWindowInfosListeners.size() == 1) {
binder::Status s = surfaceComposer->removeWindowInfosListener(this);
status = statusTFromBinderStatus(s);