mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Statusbar items weren't unregistered correctly when script was unloaded.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1871 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
a5142ec311
commit
b5fa93c6e7
@ -4,8 +4,9 @@ static GHashTable *perl_sbar_defs;
|
|||||||
|
|
||||||
static int check_sbar_destroy(char *key, char *value, char *script)
|
static int check_sbar_destroy(char *key, char *value, char *script)
|
||||||
{
|
{
|
||||||
if (strncmp(key, script, strlen(script)) == 0 &&
|
if (strncmp(value, script, strlen(script)) == 0 &&
|
||||||
key[strlen(script)] == ':') {
|
value[strlen(script)] == ':') {
|
||||||
|
statusbar_item_unregister(key);
|
||||||
g_free(key);
|
g_free(key);
|
||||||
g_free(value);
|
g_free(value);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -14,18 +15,18 @@ static int check_sbar_destroy(char *key, char *value, char *script)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sig_script_destroy(PERL_SCRIPT_REC *script)
|
static void sig_script_destroyed(PERL_SCRIPT_REC *script)
|
||||||
{
|
{
|
||||||
g_hash_table_foreach_remove(perl_sbar_defs,
|
g_hash_table_foreach_remove(perl_sbar_defs,
|
||||||
(GHRFunc) check_sbar_destroy,
|
(GHRFunc) check_sbar_destroy,
|
||||||
script->name);
|
script->package);
|
||||||
}
|
}
|
||||||
|
|
||||||
void perl_statusbar_init(void)
|
void perl_statusbar_init(void)
|
||||||
{
|
{
|
||||||
perl_sbar_defs = g_hash_table_new((GHashFunc) g_str_hash,
|
perl_sbar_defs = g_hash_table_new((GHashFunc) g_str_hash,
|
||||||
(GCompareFunc) g_str_equal);
|
(GCompareFunc) g_str_equal);
|
||||||
signal_add("script destroy", (SIGNAL_FUNC) sig_script_destroy);
|
signal_add("script destroyed", (SIGNAL_FUNC) sig_script_destroyed);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void statusbar_item_def_destroy(void *key, void *value)
|
static void statusbar_item_def_destroy(void *key, void *value)
|
||||||
@ -36,7 +37,7 @@ static void statusbar_item_def_destroy(void *key, void *value)
|
|||||||
|
|
||||||
void perl_statusbar_deinit(void)
|
void perl_statusbar_deinit(void)
|
||||||
{
|
{
|
||||||
signal_remove("script destroy", (SIGNAL_FUNC) sig_script_destroy);
|
signal_remove("script destroyed", (SIGNAL_FUNC) sig_script_destroyed);
|
||||||
|
|
||||||
g_hash_table_foreach(perl_sbar_defs,
|
g_hash_table_foreach(perl_sbar_defs,
|
||||||
(GHFunc) statusbar_item_def_destroy, NULL);
|
(GHFunc) statusbar_item_def_destroy, NULL);
|
||||||
|
Loading…
Reference in New Issue
Block a user