Fix coverity issue (Do not throw std::bad_weak_ptr exception at destructor) 42/309042/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 4 Apr 2024 06:52:15 +0000 (15:52 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 4 Apr 2024 06:53:10 +0000 (15:53 +0900)
Change-Id: Iba08499e866dbebbdb24d2dc4433b485909f7b61
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali-extension/web-engine-chromium/tizen-web-engine-manager.cpp [changed mode: 0755->0644]

old mode 100755 (executable)
new mode 100644 (file)
index ed0ed11..693cd6f
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <ewk_context_internal.h>
 #include <ewk_main.h>
 
+#include <memory>
 #include <stdexcept>
 
 namespace Dali
 {
 namespace Plugin
 {
-
 WebEngineManager& WebEngineManager::Get()
 {
   static WebEngineManager instance;
@@ -76,6 +76,10 @@ WebEngineManager::~WebEngineManager()
       // Call OnTerminated directly.
       OnTerminated();
     }
+    catch(std::bad_weak_ptr const& ex)
+    {
+      DALI_LOG_ERROR("WebEngineManager::~WebEngineManager() - std::bad_weak_ptr caught: %s\n", ex.what());
+    }
     catch(std::invalid_argument const& ex)
     {
       DALI_LOG_RELEASE_INFO("Failed to destroy web engine:%s!\n", ex.what());
@@ -126,7 +130,7 @@ Evas_Object* WebEngineManager::Find(Dali::WebEnginePlugin* plugin)
 {
   for(auto it = mWebEngines.begin(); it != mWebEngines.end(); it++)
   {
-    if (it->second == plugin)
+    if(it->second == plugin)
     {
       return it->first;
     }