diff options
author | Timo Sirainen <cras@irssi.org> | 2003-05-13 17:57:48 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2003-05-13 17:57:48 +0000 |
commit | 5fcdf3cb83f3ede01da767e8e834e974b42b019e (patch) | |
tree | 793c189773ba8bd7da1817a2f295206244414d2e /src/core/settings.c | |
parent | b7aa6d0232619a9d259433020637b0c00e84f4b3 (diff) | |
download | irssi-5fcdf3cb83f3ede01da767e8e834e974b42b019e.zip |
Fix crash with unloading module, by c0ffee
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3112 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/core/settings.c')
-rw-r--r-- | src/core/settings.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/core/settings.c b/src/core/settings.c index 562ca685..62dd5053 100644 --- a/src/core/settings.c +++ b/src/core/settings.c @@ -265,10 +265,11 @@ static void settings_destroy(SETTINGS_REC *rec) g_free(rec); } -static void settings_unref(SETTINGS_REC *rec) +static void settings_unref(SETTINGS_REC *rec, int remove_hash) { if (--rec->refcount == 0) { - g_hash_table_remove(settings, rec->key); + if (remove_hash) + g_hash_table_remove(settings, rec->key); settings_destroy(rec); } } @@ -281,14 +282,14 @@ void settings_remove(const char *key) rec = g_hash_table_lookup(settings, key); if (rec != NULL) - settings_unref(rec); + settings_unref(rec, TRUE); } static int settings_remove_hash(const char *key, SETTINGS_REC *rec, const char *module) { if (strcmp(rec->module, module) == 0) { - settings_unref(rec); + settings_unref(rec, FALSE); return TRUE; } |