electron-push-receiver icon indicating copy to clipboard operation
electron-push-receiver copied to clipboard

Don't send messages to destroyed webContents

Open ibash opened this issue 7 years ago • 4 comments

This commit:

  1. Prevents sending messages to destroyed webContents (which result in a crash)
  2. Allows registering multiple webContents for push notifications

We need this because we are listening for notifcations in a specific webContents. If it crashes we create a new one and call setup again, without this change the next push notification that came in would cause a crash.

ibash avatar Jan 31 '18 23:01 ibash

cc @MatthieuLemoine I tried to make the minimal change to make this work, but I think I'd like to do some refactoring later on to make it s.t. each call to setup is isolated from one another, what do you think?

ibash avatar Jan 31 '18 23:01 ibash

Hit a weird electron crash, so I removed the call to isDestroyed: https://github.com/electron/electron/issues/11797

ibash avatar Feb 01 '18 01:02 ibash

Hey it seems like the crash I was experiencing might be unrelated to this project, doing some more digging now...

ibash avatar Feb 01 '18 22:02 ibash

Okay - the other crash I was getting was https://github.com/electron/electron/issues/11797 I think this change is still needed to prevent the main process from crashing when the webContents that's setup to receive notifications crashes...

ibash avatar Feb 02 '18 00:02 ibash