From 10bd1773b5652c104aa23dbbc5e38e18c2aaaf08 Mon Sep 17 00:00:00 2001 From: Seonghyun Kim Date: Mon, 23 Sep 2024 13:35:45 +0900 Subject: [PATCH] [Tizen] Fix engine destory problem when WebView.Dispose method is called by csharp Change-Id: Id1db912956cc034a04d215a98ec9725f012d7a53 Signed-off-by: Seonghyun Kim --- .../web-engine-lwe/tizen-web-engine-lwe.cpp | 25 +++++++++++++++------- .../web-engine-lwe/tizen-web-engine-lwe.h | 1 + 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/dali-extension/web-engine-lwe/tizen-web-engine-lwe.cpp b/dali-extension/web-engine-lwe/tizen-web-engine-lwe.cpp index f8768c0..a4ab689 100755 --- a/dali-extension/web-engine-lwe/tizen-web-engine-lwe.cpp +++ b/dali-extension/web-engine-lwe/tizen-web-engine-lwe.cpp @@ -332,6 +332,7 @@ TizenWebEngineLWE::TizenWebEngineLWE() mIsMouseLbuttonDown(false), mCanGoBack(false), mCanGoForward(false), + mInDestroyingLWEInstance(false), mWebContainer(NULL), mDaliImageSrc(NativeImageSource::New(0, 0, NativeImageSource::COLOR_DEPTH_DEFAULT)), mNativeDisplay(NULL), @@ -355,6 +356,7 @@ TizenWebEngineLWE::TizenWebEngineLWE() TizenWebEngineLWE::~TizenWebEngineLWE() { + Destroy(); } static std::string Langset() @@ -540,6 +542,10 @@ void TizenWebEngineLWE::Create(uint32_t width, uint32_t height, const std::strin void TizenWebEngineLWE::TryRendering() { + if (mInDestroyingLWEInstance) { + return; + } + if (mTbmQueue) { if ((size_t)tbm_surface_queue_get_width(mTbmQueue) != mWebContainer->Width() || @@ -577,6 +583,10 @@ void TizenWebEngineLWE::TryRendering() void TizenWebEngineLWE::TryUpdateImage(bool needsSync) { + if (mInDestroyingLWEInstance) { + return; + } + mInImageUpdateState = true; if (!eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) { @@ -657,14 +667,7 @@ void TizenWebEngineLWE::PrepareLWERendering() void TizenWebEngineLWE::Destroy() { DestroyRenderingContext(); - - if(!mWebContainer) - { - return; - } - DestroyInstance(); - mWebContainer = NULL; } void TizenWebEngineLWE::InitRenderingContext() @@ -1120,8 +1123,14 @@ Dali::WebEngineBackForwardList& TizenWebEngineLWE::GetBackForwardList() const void TizenWebEngineLWE::DestroyInstance() { - DALI_ASSERT_ALWAYS(mWebContainer); + if(!mWebContainer) + { + return; + } + mInDestroyingLWEInstance = true; mWebContainer->Destroy(); + mInDestroyingLWEInstance = false; + mWebContainer = NULL; } Dali::NativeImageSourcePtr TizenWebEngineLWE::GetNativeImageSource() diff --git a/dali-extension/web-engine-lwe/tizen-web-engine-lwe.h b/dali-extension/web-engine-lwe/tizen-web-engine-lwe.h index 7f8542a..db8a780 100755 --- a/dali-extension/web-engine-lwe/tizen-web-engine-lwe.h +++ b/dali-extension/web-engine-lwe/tizen-web-engine-lwe.h @@ -620,6 +620,7 @@ private: bool mIsMouseLbuttonDown; bool mCanGoBack; bool mCanGoForward; + bool mInDestroyingLWEInstance; std::function mOnReceivedError; std::function mOnPageFinishedHandler; -- 2.7.4