From 3e1e6345b3a7a8634b9d3d478079f3d8da078682 Mon Sep 17 00:00:00 2001 From: handa Date: Mon, 21 Nov 2005 01:06:37 +0000 Subject: [PATCH] (fontset_table): New variable. (free_fontset): Call M17N_OBJECT_UNREGISTER. (mfont__fontset_init): Add fontset_table as an object array. (mfont__realize_fontset): Ref FONTSET. (mfont__free_realized_fontset): Unref REALIZED->fontset. (mfontset): Call M17N_OBJECT_REGISTER. (mfontset_copy): Likewise. --- src/fontset.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/fontset.c b/src/fontset.c index 8830461..fb684e9 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -74,6 +74,8 @@ #include "font.h" #include "fontset.h" +static M17NObjectArray fontset_table; + struct MFontset { M17NObject control; @@ -287,6 +289,7 @@ free_fontset (void *object) M17N_OBJECT_UNREF (fontset_list); fontset_list = NULL; } + M17N_OBJECT_UNREGISTER (fontset_table, fontset); free (object); } @@ -462,6 +465,8 @@ update_fontset_elements (MRealizedFontset *realized) int mfont__fontset_init () { + M17N_OBJECT_ADD_ARRAY (fontset_table, "Fontset"); + Mfontset = msymbol ("fontset"); Mfontset->managing_key = 1; fontset_list = mplist (); @@ -521,6 +526,7 @@ mfont__realize_fontset (MFrame *frame, MFontset *fontset, MSTRUCT_CALLOC (realized, MERROR_FONTSET); realized->fontset = fontset; + M17N_OBJECT_REF (fontset); realized->tick = fontset->tick; if (spec) { @@ -539,6 +545,7 @@ void mfont__free_realized_fontset (MRealizedFontset *realized) { free_realized_fontset_elements (realized); + M17N_OBJECT_UNREF (realized->fontset); if (realized->spec) free (realized->spec); free (realized); @@ -906,6 +913,7 @@ mfontset (char *name) else { M17N_OBJECT (fontset, free_fontset, MERROR_FONTSET); + M17N_OBJECT_REGISTER (fontset_table, fontset); fontset->name = sym; fontset->mdb = mdatabase_find (Mfontset, sym, Mnil, Mnil); if (! fontset->mdb) @@ -963,6 +971,7 @@ mfontset_copy (MFontset *fontset, char *name) if (copy) return NULL; M17N_OBJECT (copy, free_fontset, MERROR_FONTSET); + M17N_OBJECT_REGISTER (fontset_table, copy); copy->name = sym; if (fontset->mdb) -- 1.7.10.4