mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 22:44:50 +02:00
Fix leak when changing window logo
This commit is contained in:
@@ -230,6 +230,7 @@ set_window_logo(Window *w, const char *path, const ImageAnchorPosition pos, floa
|
||||
if (path && path[0]) {
|
||||
window_logo_id_t wl = find_or_create_window_logo(global_state.all_window_logos, path);
|
||||
if (wl) {
|
||||
if (w->window_logo.id) decref_window_logo(global_state.all_window_logos, w->window_logo.id);
|
||||
w->window_logo.id = wl;
|
||||
w->window_logo.position = pos;
|
||||
w->window_logo.alpha = alpha;
|
||||
|
||||
@@ -53,7 +53,10 @@ find_or_create_window_logo(WindowLogoTable *head, const char *path) {
|
||||
WindowLogoItem *s = NULL;
|
||||
unsigned _uthash_hfstr_keylen = (unsigned)uthash_strlen(path);
|
||||
HASH_FIND(hh_path, head->by_path, path, _uthash_hfstr_keylen, s);
|
||||
if (s) return s->id;
|
||||
if (s) {
|
||||
s->refcnt++;
|
||||
return s->id;
|
||||
}
|
||||
s = calloc(1, sizeof *s);
|
||||
size_t size;
|
||||
if (!s) { PyErr_NoMemory(); return 0; }
|
||||
|
||||
Reference in New Issue
Block a user