Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent destroyed view references from causing crashes #25411

Merged
merged 13 commits into from Sep 17, 2020

Conversation

mlaurencin
Copy link
Contributor

@mlaurencin mlaurencin commented Sep 10, 2020

Description of Change

Closes #21666.
Closes #21410.

This PR is fixing crashes caused by referencing and attempting to modify previously destroyed views.
Before, when a view was destroyed and then the contents were referenced for modification, the system would crash as undefined memory was accessed. This fix explicitly makes the pointer to the destroyed view's contents null, so that this will not happen.

Checklist

Release Notes

Notes: Fixed crashes caused by attempting to modify destroyed views

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 10, 2020
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Sep 11, 2020
Copy link
Member

@codebytere codebytere left a comment

Choose a reason for hiding this comment

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

This is a great start! as the crash in setBounds is but a symptom of a larger set of potential crashes, though, we'll want to make sure we address all similar potential crashes as well as try to add regression tests for all related crashes to really close up this bug :)

shell/browser/native_browser_view_views.cc Outdated Show resolved Hide resolved
@codebytere
Copy link
Member

Looks like lint is still failing: see https://app.circleci.com/pipelines/github/electron/electron/29870/workflows/28683667-5c33-4ba1-a255-70e8d981c345/jobs/658611 for details :) You can check these locally with npm run lint

@mlaurencin
Copy link
Contributor Author

mlaurencin commented Sep 16, 2020

Looks like lint is still failing: see https://app.circleci.com/pipelines/github/electron/electron/29870/workflows/28683667-5c33-4ba1-a255-70e8d981c345/jobs/658611 for details :) You can check these locally with npm run lint

Great! Pushing the fix now. I was actually using the notes from the errors in CI to make the fixes. I am getting local errors when running npm run lint saying "'gn' is not recognized as an internal or external command"

@MarshallOfSound
Copy link
Member

I am getting local errors when running npm run lint saying "'gn' is not recognized as an internal or external command"

Ah that's because you're exclusively on build tools I think. @codebytere we should either make e lint or come up with a better way of making those commands available.

@mlaurencin for now e d npm run lint would probably work (I know it looks funky but it works) 😆

@mlaurencin mlaurencin changed the title [WIP] fix: prevent destroyed view references from causing crashes fix: prevent destroyed view references from causing crashes Sep 16, 2020
@mlaurencin
Copy link
Contributor Author

e d npm run lint

I am getting local errors when running npm run lint saying "'gn' is not recognized as an internal or external command"

Ah that's because you're exclusively on build tools I think. @codebytere we should either make e lint or come up with a better way of making those commands available.

@mlaurencin for now e d npm run lint would probably work (I know it looks funky but it works) 😆

I tried running that and ended up with this new error ERROR Failed to run command, exit code was "null", error was 'Error: spawnSync npm ENOENT' 😅 @codebytere

@codebytere codebytere marked this pull request as ready for review September 16, 2020 20:34
@trop
Copy link
Contributor

trop bot commented Sep 17, 2020

I have automatically backported this PR to "9-x-y", please check out #25510

@trop
Copy link
Contributor

trop bot commented Sep 17, 2020

I have automatically backported this PR to "10-x-y", please check out #25511

mlaurencin added a commit to mlaurencin/electron that referenced this pull request Sep 23, 2020
…#25411)

Closes electron#21666.

This PR is fixing crashes caused by referencing and attempting to modify previously destroyed views.
Before, when a view was destroyed and then the contents were referenced for modification, the system would crash as undefined memory was accessed. This fix explicitly makes the pointer to the destroyed view's contents null, so that this will not happen.
mlaurencin added a commit to mlaurencin/electron that referenced this pull request Sep 23, 2020
(cont.) references from causing crashes
Referenced PR: electron#25411
@trop
Copy link
Contributor

trop bot commented Sep 23, 2020

@mlaurencin has manually backported this PR to "9-x-y", please check out #25609

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants