1
0
mirror of https://github.com/irssi/irssi.git synced 2024-06-23 06:35:36 +00: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:
Timo Sirainen 2001-08-08 16:08:47 +00:00 committed by cras
parent d248a87497
commit 4737d16290
3 changed files with 18 additions and 6 deletions

View File

@ -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)
{
@ -403,7 +404,11 @@ WINDOW_BIND_REC *window_bind_add(WINDOW_REC *window, const char *servertag,
g_return_val_if_fail(window != NULL, NULL);
g_return_val_if_fail(servertag != NULL, NULL);
g_return_val_if_fail(name != 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);

View File

@ -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);

View File

@ -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,11 +256,16 @@ 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)) {
window = rec;
clear_waiting = FALSE;
break;
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: