From f3b0b72908a7c0d460deef30a1d6b08fddef0017 Mon Sep 17 00:00:00 2001 From: handa Date: Fri, 14 Oct 2005 02:25:02 +0000 Subject: [PATCH] (free_fontset): Unref fontset_list if necessary. (mfont__fontset_fini): Don't free fontset_list. Unref default_fontset. (mfont__realize_fontset): Initialize request. (mfontset): Ref default_fontset or fontset only if necessary. (mfontset_copy): Don't ref copy. --- src/fontset.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/src/fontset.c b/src/fontset.c index a0eecbd..c83083e 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -282,6 +282,11 @@ free_fontset (void *object) if (! plist) mdebug_hook (); mplist_pop (plist); + if (MPLIST_TAIL_P (fontset_list)) + { + M17N_OBJECT_UNREF (fontset_list); + fontset_list = NULL; + } free (object); } @@ -473,10 +478,8 @@ mfont__fontset_init () void mfont__fontset_fini () { - while (! MPLIST_TAIL_P (fontset_list)) - free_fontset ((MFontset *) MPLIST_VAL (fontset_list)); - M17N_OBJECT_UNREF (fontset_list); - fontset_list = NULL; + M17N_OBJECT_UNREF (default_fontset); + default_fontset = NULL; } @@ -491,6 +494,7 @@ mfont__realize_fontset (MFrame *frame, MFontset *fontset, if (fontset->mdb) load_fontset_contents (fontset); + MFONT_INIT (&request); mfont__set_spec_from_face (&request, face); if (request.size <= 0) { @@ -878,12 +882,17 @@ mfontset (char *name) MFontset *fontset; if (! name) - fontset = default_fontset; + { + fontset = default_fontset; + M17N_OBJECT_REF (fontset); + } else { sym = msymbol (name); fontset = mplist_get (fontset_list, sym); - if (! fontset) + if (fontset) + M17N_OBJECT_REF (fontset); + else { M17N_OBJECT (fontset, free_fontset, MERROR_FONTSET); fontset->name = sym; @@ -897,7 +906,6 @@ mfontset (char *name) mplist_put (fontset_list, sym, fontset); } } - M17N_OBJECT_REF (fontset); return fontset; } @@ -994,7 +1002,6 @@ mfontset_copy (MFontset *fontset, char *name) } mplist_put (fontset_list, sym, copy); - M17N_OBJECT_REF (copy); return copy; } -- 1.7.10.4