Check whether sender is destroyed before calling sender.send
Fix #4279.
This commit is contained in:
parent
5d16257c2d
commit
3f68b2f227
1 changed files with 2 additions and 2 deletions
|
@ -162,12 +162,12 @@ var unwrapArgs = function(sender, args) {
|
|||
});
|
||||
|
||||
let callIntoRenderer = function(...args) {
|
||||
if (rendererReleased)
|
||||
if (rendererReleased || sender.isDestroyed())
|
||||
throw new Error(`Attempting to call a function in a renderer window that has been closed or released. Function provided here: ${meta.location}.`);
|
||||
sender.send('ATOM_RENDERER_CALLBACK', meta.id, valueToMeta(sender, args));
|
||||
};
|
||||
v8Util.setDestructor(callIntoRenderer, function() {
|
||||
if (!rendererReleased)
|
||||
if (!rendererReleased && !sender.isDestroyed())
|
||||
sender.send('ATOM_RENDERER_RELEASE_CALLBACK', meta.id);
|
||||
});
|
||||
sender.callbacks.set(meta.id, callIntoRenderer);
|
||||
|
|
Loading…
Reference in a new issue