Skip to content

More safety checks around IPC communication#849

Merged
fredrikekelund merged 3 commits into
trunkfrom
f26d/more-is-destroyed-checks
Jan 28, 2025
Merged

More safety checks around IPC communication#849
fredrikekelund merged 3 commits into
trunkfrom
f26d/more-is-destroyed-checks

Conversation

@fredrikekelund
Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

With the help of some AI debugging in Sentry, I determined that https://github.com/Automattic/dotcom-forge/issues/10346 seems to be happening because we send IPC messages to windows that have been destroyed. This PR adds some additional isDestroyed checks to mitigate that (see 0ae3042).

I also took the opportunity to refactor withMainWindow into a function that returns a promise instead. There's really no reason for it to accept a callback, so this helps keep our code clean and simple.

Testing Instructions

Smoke test the app. Ensure that the About menu, the settings, and the fullscreen view work as expected.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@fredrikekelund fredrikekelund requested a review from a team January 27, 2025 14:42
@fredrikekelund fredrikekelund self-assigned this Jan 27, 2025
Copy link
Copy Markdown
Contributor

@wojtekn wojtekn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code change looks clear, and it's more readable now.

I smoke tested different Studio features and haven't noticed any issues.

@fredrikekelund fredrikekelund merged commit e7a67f7 into trunk Jan 28, 2025
@fredrikekelund fredrikekelund deleted the f26d/more-is-destroyed-checks branch January 28, 2025 09:14
bgrgicak pushed a commit that referenced this pull request Jan 29, 2025
* WIP

* withMainWindow -> getMainWindow

* Refinements
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants