Fix leak when changing window logo
This commit is contained in:
parent
799881af2d
commit
0456399ce5
2 changed files with 5 additions and 1 deletions
|
|
@ -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; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue