mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Fixed memory leak in obtaining doNotDisturb value on macOS.
This commit is contained in:
@@ -33,13 +33,14 @@ void queryDoNotDisturbState() {
|
||||
}
|
||||
LastSettingsQueryMs = ms;
|
||||
|
||||
auto userDefaults = [NSUserDefaults alloc];
|
||||
if ([userDefaults respondsToSelector:@selector(initWithSuiteName:)]) {
|
||||
id userDefaultsValue = [[[NSUserDefaults alloc] initWithSuiteName:@"com.apple.notificationcenterui"] objectForKey:@"doNotDisturb"];
|
||||
DoNotDisturbEnabled = ([userDefaultsValue boolValue] == YES);
|
||||
} else {
|
||||
DoNotDisturbEnabled = false;
|
||||
}
|
||||
Boolean isKeyValid;
|
||||
const auto doNotDisturb = CFPreferencesGetAppBooleanValue(
|
||||
CFSTR("doNotDisturb"),
|
||||
CFSTR("com.apple.notificationcenterui"),
|
||||
&isKeyValid);
|
||||
DoNotDisturbEnabled = isKeyValid
|
||||
? doNotDisturb
|
||||
: false;
|
||||
}
|
||||
|
||||
using Manager = Platform::Notifications::Manager;
|
||||
|
||||
Reference in New Issue
Block a user