fix: crash with creating OffScreenWebContentsView (#42920)

On the Mac platform, OffScreenWebContentsView uses Automatic Reference
Counting (ARC) to handle the lifecycle of offScreenView_. However, this
private member variable is not initialized and its value is undefined.
In some cases, it is initialized to a garbage value, which may cause ARC
to release the value incorrectly, resulting in a crash.
This commit is contained in:
wujinli 2024-07-17 19:09:32 +08:00 коммит произвёл GitHub
Родитель 2875fab452
Коммит 9023707b9b
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -109,7 +109,7 @@ class OffScreenWebContentsView : public content::WebContentsView,
raw_ptr<content::WebContents> web_contents_ = nullptr;
#if BUILDFLAG(IS_MAC)
RAW_PTR_EXCLUSION OffScreenView* offScreenView_;
RAW_PTR_EXCLUSION OffScreenView* offScreenView_ = nullptr;
#endif
};