fix: use OS process handle to clear object registry (#14324)
RenderProcessHost switch can happen between ipc calls when speculative process are invvolved, which will lead to deletion of entries on current context. Use OS process handles to uniquely associate a destruction handler for a render process.
This commit is contained in:
parent
98b7a9ce9c
commit
edd5c4b9bb
4 changed files with 10 additions and 7 deletions
|
@ -103,9 +103,10 @@ class ObjectsRegistry {
|
|||
|
||||
// Private: Clear the storage when renderer process is destroyed.
|
||||
registerDeleteListener (webContents, contextId) {
|
||||
const processId = webContents.getProcessId()
|
||||
const listener = (event, deletedProcessId) => {
|
||||
if (deletedProcessId === processId) {
|
||||
// contextId => ${OSProcessId}-${contextCount}
|
||||
const OSProcessId = contextId.split('-')[0]
|
||||
const listener = (event, deletedProcessId, deletedOSProcessId) => {
|
||||
if (deletedOSProcessId && deletedOSProcessId.toString() === OSProcessId) {
|
||||
webContents.removeListener('render-view-deleted', listener)
|
||||
this.clear(webContents, contextId)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue