From: handa Date: Fri, 14 Oct 2005 02:25:02 +0000 (+0000) Subject: (free_fontset): Unref fontset_list if necessary. X-Git-Tag: REL-1-3-0~131 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=f3b0b72908a7c0d460deef30a1d6b08fddef0017;p=m17n%2Fm17n-lib.git (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. --- 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; }