From: handa Date: Fri, 19 Nov 2004 11:22:20 +0000 (+0000) Subject: (load_input_method): Don't unref `maps' it it's not created. X-Git-Tag: REL-1-2-0~82 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b21c19f4ea52791d9be8b9a42609a309fdb4e3e;p=m17n%2Fm17n-lib.git (load_input_method): Don't unref `maps' it it's not created. --- diff --git a/src/input.c b/src/input.c index 42fa7a5..b3a8f8d 100644 --- a/src/input.c +++ b/src/input.c @@ -692,8 +692,6 @@ load_input_method (MSymbol language, MSymbol name, MPlist *plist, MPlist *macros = NULL; MPlist *elt; - if (! MPLIST_PLIST_P (plist)) - MERROR (MERROR_IM, -1); for (; MPLIST_PLIST_P (plist); plist = MPLIST_NEXT (plist)) { elt = MPLIST_PLIST (plist); @@ -753,9 +751,12 @@ load_input_method (MSymbol language, MSymbol name, MPlist *plist, } } - MPLIST_DO (elt, maps) - M17N_OBJECT_UNREF (MPLIST_VAL (elt)); - M17N_OBJECT_UNREF (maps); + if (maps) + { + MPLIST_DO (elt, maps) + M17N_OBJECT_UNREF (MPLIST_VAL (elt)); + M17N_OBJECT_UNREF (maps); + } if (! title) title = mtext_from_data (MSYMBOL_NAME (name), MSYMBOL_NAMELEN (name), MTEXT_FORMAT_US_ASCII); @@ -1506,7 +1507,10 @@ reset_ic (MInputContext *ic) MInputContextInfo *ic_info = (MInputContextInfo *) ic->info; MLIST_RESET (ic_info); - ic_info->state = (MIMState *) MPLIST_VAL (im_info->states); + if (im_info->states) + ic_info->state = (MIMState *) MPLIST_VAL (im_info->states); + else + ic_info->state = NULL; ic_info->map = ic_info->state ? ic_info->state->map : NULL; ic_info->state_key_head = ic_info->key_head = 0; ic->cursor_pos = ic_info->state_pos = 0;