Repository navigation
fix: shutdown crash when unregistering power notification on windows - #50878
Merged
Merged
Conversation
Refs https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-unregistersuspendresumenotification the handle should be the return value of registeration api not the window handle.
Followup to 7c0cb61
codebytere
approved these changes
Apr 10, 2026
|
Release Notes Persisted
|
Contributor
|
I was unable to backport this PR to "39-x-y" cleanly; |
Contributor
|
I was unable to backport this PR to "40-x-y" cleanly; |
Contributor
|
I was unable to backport this PR to "41-x-y" cleanly; |
Contributor
|
I have automatically backported this PR to "42-x-y", please check out #50893 |
3 tasks done
2 tasks done
3 tasks done
Contributor
|
@VerteDinde has manually backported this PR to "41-x-y", please check out #52999 |
MarshallOfSound
pushed a commit
that referenced
this pull request
Aug 19, 2026
…52999) fix: shutdown crash when unregistering power notification on windows (#50878) 41-x-y note: PowerMonitor is not cppgc-managed on this branch, so only the RegisterSuspendResumeNotification handle fix is carried; the SelfKeepAlive removal does not apply. (cherry picked from commit 05f1cb5) Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
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]>
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores (44-x-y) (#54408) fix: stop registering powerMonitor for Windows suspend notifications it ignores (#54352) * fix: stop registering powerMonitor for Windows suspend notifications it ignores 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. (cherry picked from commit 98704f6)
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
Extracted from #50465
Followup to #50045
Refs https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-unregistersuspendresumenotification
the handle to unregister should be the return value of registeration api not the window handle.
Release Notes
Notes: Fixed shutdown crash on windows when power monitor notifications were subscribed.