mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: dangling raw_ptr ElectronBrowserContext::extension_system_ (#42814)
The extension system is freed by the DestroyBrowserContextServices() call in the destructor, so we need to zero out the pointer to avoid a dangling raw_ptr error. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
@@ -372,6 +372,10 @@ ElectronBrowserContext::ElectronBrowserContext(
|
||||
ElectronBrowserContext::~ElectronBrowserContext() {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
NotifyWillBeDestroyed();
|
||||
|
||||
// the DestroyBrowserContextServices() call below frees this.
|
||||
extension_system_ = nullptr;
|
||||
|
||||
// Notify any keyed services of browser context destruction.
|
||||
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
|
||||
this);
|
||||
|
||||
Reference in New Issue
Block a user