mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-06-30 21:03:30 +00:00
Fix incorrect decrement of the reference counts of objects
Found with the Clang Static Analyzer. The function `schedule_notification()` for the new notification API also does not `release` similar objects.
This commit is contained in:
parent
0870a33956
commit
7ad360d872
1 changed files with 3 additions and 8 deletions
|
|
@ -182,14 +182,9 @@ cocoa_send_notification(PyObject *self UNUSED, PyObject *args) {
|
|||
if (!center) {PyErr_SetString(PyExc_RuntimeError, "Failed to get the user notification center"); return NULL; }
|
||||
if (!center.delegate) center.delegate = [[NotificationDelegate alloc] init];
|
||||
NSUserNotification *n = [NSUserNotification new];
|
||||
#define SET(x) { \
|
||||
if (x) { \
|
||||
NSString *t = @(x); \
|
||||
n.x = t; \
|
||||
[t release]; \
|
||||
}}
|
||||
SET(title); SET(subtitle); SET(informativeText);
|
||||
#undef SET
|
||||
if (title) n.title = @(title);
|
||||
if (subtitle) n.subtitle = @(subtitle);
|
||||
if (informativeText) n.informativeText = @(informativeText);
|
||||
if (identifier) {
|
||||
n.userInfo = @{@"user_id": @(identifier)};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue