[M67 Migration] Prevent double free of MailboxManager unique pointer 59/189559/3
authorUzair <uzair.jaleel@samsung.com>
Tue, 18 Sep 2018 13:22:53 +0000 (18:52 +0530)
committerUzair <uzair.jaleel@samsung.com>
Wed, 19 Sep 2018 12:27:31 +0000 (17:57 +0530)
Crash is observed at browser shutdown as MaiboxManager is getting
deleted twice, once when GpuChannelManager is destroyed and again
in SharedMailboxManager. Since we already maintain a unique pointer
(static) for MailboxManager in SharedMailboxManager, GpuChannelManager
doesn't necessarily need to have another.

This patch also avoids creation of GLShareGroup and MailboxManager
in GpuChannelManager as they are anyway overriden in GpuChildThreadEfl.

Reference :
https://review.tizen.org/gerrit/#/c/179612

Change-Id: I3d4e7e211bb1260ccf28a03da92a94b39f6a16d0
Signed-off-by: Uzair <uzair.jaleel@samsung.com>
gpu/ipc/service/gpu_channel_manager.cc
gpu/ipc/service/gpu_channel_manager.h
tizen_src/chromium_impl/content/gpu/in_process_gpu_thread_efl.cc

index d055d94..01ded8c 100644 (file)
@@ -64,8 +64,10 @@ GpuChannelManager::GpuChannelManager(
           gpu_feature_info.enabled_gpu_driver_bug_workarounds),
       delegate_(delegate),
       watchdog_(watchdog),
+#if !defined(USE_EFL)
       share_group_(new gl::GLShareGroup()),
       mailbox_manager_(gles2::CreateMailboxManager(gpu_preferences)),
+#endif
       gpu_memory_manager_(this),
       scheduler_(scheduler),
       sync_point_manager_(sync_point_manager),
index 598f39e..8dd2779 100644 (file)
@@ -127,7 +127,11 @@ class GPU_IPC_SERVICE_EXPORT GpuChannelManager {
 
   bool is_exiting_for_lost_context() { return exiting_for_lost_context_; }
 
+#if defined(USE_EFL)
+  MailboxManager* mailbox_manager() { return mailbox_manager_; }
+#else
   MailboxManager* mailbox_manager() { return mailbox_manager_.get(); }
+#endif
 
   gl::GLShareGroup* share_group() const { return share_group_.get(); }
 
@@ -161,8 +165,11 @@ class GPU_IPC_SERVICE_EXPORT GpuChannelManager {
   GpuWatchdogThread* watchdog_;
 
   scoped_refptr<gl::GLShareGroup> share_group_;
-
+#if defined(USE_EFL)
+  MailboxManager* mailbox_manager_;
+#else
   std::unique_ptr<MailboxManager> mailbox_manager_;
+#endif
   std::unique_ptr<gles2::Outputter> outputter_;
   GpuMemoryManager gpu_memory_manager_;
   Scheduler* scheduler_;
index 230a80d..665b769 100644 (file)
@@ -34,7 +34,7 @@ struct GpuChildThreadEfl : public content::GpuChildThread {
     gpu_service->gpu_channel_manager()->share_group_ =
         GLSharedContextEfl::GetShareGroup();
     gpu_service->gpu_channel_manager()->mailbox_manager_ =
-        base::WrapUnique(SharedMailboxManager::GetMailboxManager());
+        SharedMailboxManager::GetMailboxManager();
   }
 };