summaryrefslogtreecommitdiff
path: root/src/core/settings.c
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2003-05-13 17:57:48 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2003-05-13 17:57:48 +0000
commit5fcdf3cb83f3ede01da767e8e834e974b42b019e (patch)
tree793c189773ba8bd7da1817a2f295206244414d2e /src/core/settings.c
parentb7aa6d0232619a9d259433020637b0c00e84f4b3 (diff)
downloadirssi-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.c9
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;
}