From: hyunho Date: Tue, 13 Nov 2018 08:29:59 +0000 (+0900) Subject: Check buffer duplication X-Git-Tag: accepted/tizen/5.0/unified/20181114.191842~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F66%2F192966%2F2;p=platform%2Fcore%2Fappfw%2Fscreen-connector.git Check buffer duplication If we do not check it, new buffer can be destroyed and empty pointer is remained in viewer side and could cause null tbm buffer issue. Change-Id: Ib9ffc53d02ec4f181f0f4117bc35fc37317afc77 Signed-off-by: hyunho --- diff --git a/screen_connector_remote_surface/handle.h b/screen_connector_remote_surface/handle.h index 1ab7157..535e8f9 100644 --- a/screen_connector_remote_surface/handle.h +++ b/screen_connector_remote_surface/handle.h @@ -35,6 +35,9 @@ class EXPORT_API Handle { T GetRaw() const { return raw_; } bool IsOwner() { return owner_; } + void SetIsOwner(bool owner) { + owner_ = owner; + } private: T raw_; diff --git a/screen_connector_remote_surface_evas/image.cc b/screen_connector_remote_surface_evas/image.cc index df4558a..d38320f 100644 --- a/screen_connector_remote_surface_evas/image.cc +++ b/screen_connector_remote_surface_evas/image.cc @@ -14,8 +14,15 @@ * limitations under the License. */ +#include + #include "screen_connector_remote_surface_evas/image_internal.h" +#ifdef LOG_TAG +#undef LOG_TAG +#endif + +#define LOG_TAG "SC_REMOTE_SURFACE" #define SC_TOOLKIT_HANDLE_TAG "SC_TOOLKIT_HANDLE_TAG" namespace screen_connector { @@ -176,6 +183,12 @@ void Image::Update(std::shared_ptr tbm) { tbm_surface_h tbmSurface; Evas_Native_Surface ns; + /* if prev buffer is equal to current buffer, do not cleanup tizen remote surface resources */ + if (prev_buf_.get() != nullptr && tbm->GetRaw() == prev_buf_->GetRaw()) { + prev_buf_->SetIsOwner(false); + LOGW("Same buffer do not destroy buffer(%p)", tbm->GetRaw()); + } + prev_buf_ = std::move(tbm); /* get tbm surface from buffer */ tbmSurface = (tbm_surface_h)wl_buffer_get_user_data(prev_buf_->GetRaw());