mirror of
https://github.com/irssi/irssi.git
synced 2024-09-29 04:45:57 -04:00
Fixed leaking window binds. They were added but rarely removed.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1721 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
d248a87497
commit
4737d16290
@ -396,6 +396,7 @@ GSList *windows_get_sorted(void)
|
||||
return sorted;
|
||||
}
|
||||
|
||||
/* Add a new bind to window - if duplicate is found it's returned */
|
||||
WINDOW_BIND_REC *window_bind_add(WINDOW_REC *window, const char *servertag,
|
||||
const char *name)
|
||||
{
|
||||
@ -405,6 +406,10 @@ WINDOW_BIND_REC *window_bind_add(WINDOW_REC *window, const char *servertag,
|
||||
g_return_val_if_fail(servertag != NULL, NULL);
|
||||
g_return_val_if_fail(name != NULL, NULL);
|
||||
|
||||
rec = window_bind_find(window, servertag, name);
|
||||
if (rec != NULL)
|
||||
return rec;
|
||||
|
||||
rec = g_new0(WINDOW_BIND_REC, 1);
|
||||
rec->name = g_strdup(name);
|
||||
rec->servertag = g_strdup(servertag);
|
||||
|
@ -81,6 +81,7 @@ int windows_refnum_last(void);
|
||||
int window_refnum_cmp(WINDOW_REC *w1, WINDOW_REC *w2);
|
||||
GSList *windows_get_sorted(void);
|
||||
|
||||
/* Add a new bind to window - if duplicate is found it's returned */
|
||||
WINDOW_BIND_REC *window_bind_add(WINDOW_REC *window, const char *servertag,
|
||||
const char *name);
|
||||
void window_bind_destroy(WINDOW_REC *window, WINDOW_BIND_REC *rec);
|
||||
|
@ -241,6 +241,7 @@ static int window_bind_has_sticky(WINDOW_REC *window)
|
||||
void window_item_create(WI_ITEM_REC *item, int automatic)
|
||||
{
|
||||
WINDOW_REC *window;
|
||||
WINDOW_BIND_REC *bind;
|
||||
GSList *tmp, *sorted;
|
||||
int clear_waiting, reuse_unused_windows;
|
||||
|
||||
@ -255,12 +256,17 @@ void window_item_create(WI_ITEM_REC *item, int automatic)
|
||||
WINDOW_REC *rec = tmp->data;
|
||||
|
||||
/* is item bound to this window? */
|
||||
if (item->server != NULL &&
|
||||
window_bind_find(rec, item->server->tag, item->name)) {
|
||||
if (item->server != NULL) {
|
||||
bind = window_bind_find(rec, item->server->tag,
|
||||
item->name);
|
||||
if (bind != NULL) {
|
||||
if (!bind->sticky)
|
||||
window_bind_destroy(rec, bind);
|
||||
window = rec;
|
||||
clear_waiting = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* use this window IF:
|
||||
- reuse_unused_windows is ON
|
||||
|
Loading…
Reference in New Issue
Block a user