Repository navigation
fix: remove extra 'suspend'/'resume' handling from powerMonitor - #47162
Merged
Merged
Conversation
powerMonitor
powerMonitorpowerMonitor
codebytere
force-pushed
the
remove-suspend-duplicate
branch
from
May 20, 2025 13:54
9df3f1e to
0402c36
Compare
|
Release Notes Persisted
|
This was referenced May 21, 2025
Contributor
|
I have automatically backported this PR to "37-x-y", please check out #47188 |
Contributor
|
I have automatically backported this PR to "36-x-y", please check out #47189 |
Contributor
|
I have automatically backported this PR to "35-x-y", please check out #47190 |
kigh-ota
pushed a commit
to kigh-ota/electron
that referenced
this pull request
Sep 30, 2025
…ectron#47162) fix: remove extra 'suspend'/'resume' handling from powerMonitor
3 tasks done
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores #47162 removed the WM_POWERBROADCAST handling from powerMonitor's message window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session.
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores (#54352) * fix: stop registering powerMonitor for Windows suspend notifications it ignores #47162 removed the WM_POWERBROADCAST handling from powerMonitor's message window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session. * fix: complete ui::SessionChangeObserver where PowerMonitor is destroyed and emit directly ~PowerMonitor() is defined in electron_api_power_monitor.cc, which only saw the forward declaration, so the unique_ptr member did not compile on Windows. The session change callback already runs on the UI thread, so emit there instead of posting an Unretained task that nothing can cancel.
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores (#54384) * fix: stop registering powerMonitor for Windows suspend notifications it ignores #47162 removed the WM_POWERBROADCAST handling from powerMonitor's message window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session. Co-authored-by: Sam Attard <[email protected]> * fix: complete ui::SessionChangeObserver where PowerMonitor is destroyed and emit directly ~PowerMonitor() is defined in electron_api_power_monitor.cc, which only saw the forward declaration, so the unique_ptr member did not compile on Windows. The session change callback already runs on the UI thread, so emit there instead of posting an Unretained task that nothing can cancel. Co-authored-by: Sam Attard <[email protected]> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Closes #44252.
'suspend'/'resume' handling was added initially to
electron_api_power_monitor_{win|mac}prior tobase::PowerSuspendObserverbeing added upstream - these events are now emitted viaOnSuspendandOnResumeand the extra handling causes them to be emitted twice. On Windows, for example, resuming after sleeping shows:Checklist
npm testpassesRelease Notes
Notes: Fixed an issue where the 'suspend' and 'resume' events could be emitted in duplicate.