From 5210e0ebf3713c17c3c1953b489026120c0d42ba Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 28 Apr 2020 15:41:04 +0900 Subject: [PATCH] Add a flag for removed instance Change-Id: Ic0aeac0f8ff18b2af8bfcbc92f2a3b7fe8343ddb Signed-off-by: Junghoon Park --- screen_connector_remote_surface/remote_surface.cc | 10 ++++++++++ .../remote_surface_implementation.h | 1 + 2 files changed, 11 insertions(+) diff --git a/screen_connector_remote_surface/remote_surface.cc b/screen_connector_remote_surface/remote_surface.cc index 113b57f..0fc70ea 100644 --- a/screen_connector_remote_surface/remote_surface.cc +++ b/screen_connector_remote_surface/remote_surface.cc @@ -92,6 +92,9 @@ void RemoteSurface::Impl::OnAppAdded(const std::string &appId, const std::string& instId, const int pid, const unsigned int surfaceId) { + if (disposed_) + return; + if (inst_id_ != instId) return; @@ -107,17 +110,24 @@ void RemoteSurface::Impl::OnAppRemoved(const std::string& appId, const std::string& instId, const int pid, const unsigned int surfaceId) { + if (disposed_) + return; + if (inst_id_ != instId) return; LOGW("removed %s", instId.c_str()); parent_->OnBufferRemoved(appId, instId, pid); + disposed_ = true; } void RemoteSurface::Impl::OnAppUpdated(const std::string &appId, const std::string& instId, const int pid, const unsigned int surfaceId) { + if (disposed_) + return; + if (inst_id_ != instId) return; diff --git a/screen_connector_remote_surface/remote_surface_implementation.h b/screen_connector_remote_surface/remote_surface_implementation.h index af56724..dcc870f 100644 --- a/screen_connector_remote_surface/remote_surface_implementation.h +++ b/screen_connector_remote_surface/remote_surface_implementation.h @@ -84,6 +84,7 @@ class RemoteSurface::Impl : AulHandle::IEventListener, ITRS::IEventListener { RemoteSurface* parent_; bool mock_; std::unique_ptr queuing_visibility_; + bool disposed_ = false; }; } // namespace screen_connector -- 2.7.4