Skip to content

Commit

Permalink
Bug 1791531 - Do not assume that the battery listener has been regist…
Browse files Browse the repository at this point in the history
…ered correctly on macOS r=haik

Differential Revision: https://phabricator.services.mozilla.com/D157719
  • Loading branch information
gabrielesvelto committed Sep 22, 2022
1 parent 17401a5 commit 37a1555
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions hal/cocoa/CocoaBattery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,11 @@ void MacPowerInformationService::BeginListening() {
}

void MacPowerInformationService::StopListening() {
MOZ_ASSERT(mRunLoopSource,
"IOPS Notification Loop Source not set up. "
"(StopListening without BeginListening)");

::CFRunLoopRemoveSource(::CFRunLoopGetCurrent(), mRunLoopSource,
kCFRunLoopDefaultMode);
mRunLoopSource = nullptr;
if (mRunLoopSource) {
::CFRunLoopRemoveSource(::CFRunLoopGetCurrent(), mRunLoopSource,
kCFRunLoopDefaultMode);
mRunLoopSource = nullptr;
}
}

void MacPowerInformationService::HandleChange(void* aContext) {
Expand Down

0 comments on commit 37a1555

Please sign in to comment.