Skip to content

Commit 905cc0b

Browse files
authored
Power Notifications Un-register Fix (#1561)
* Un-register Fix * Comment fixed
1 parent 8c11219 commit 905cc0b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

dev/PowerNotifications/PowerNotifications.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,8 @@ namespace winrt::Microsoft::Windows::System::Power
253253
auto& eventObj{ fn.event() };
254254
std::scoped_lock<std::mutex> lock(m_mutex);
255255
eventObj.remove(token);
256-
if (RegisteredForEvents(eventObj))
256+
// If that was the last registration, remove the OS registration
257+
if (!RegisteredForEvents(eventObj))
257258
{
258259
fn.unregisterListener();
259260
}

0 commit comments

Comments
 (0)