all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Kenichi Handa <handa@m17n.org>
To: Chong Yidong <cyd@stupidchicken.com>
Cc: emacs-devel@gnu.org
Subject: Re: Crash using text property 'composite on w32
Date: Thu, 14 Jun 2007 21:32:34 +0900	[thread overview]
Message-ID: <E1HyoV8-0002KX-LC@etlken.m17n.org> (raw)
In-Reply-To: <87bqfl5g90.fsf@stupidchicken.com> (message from Chong Yidong on Tue, 12 Jun 2007 11:44:59 -0400)

In article <87bqfl5g90.fsf@stupidchicken.com>, Chong Yidong <cyd@stupidchicken.com> writes:

> The following message is a courtesy copy of an article
> that has been posted to gmane.emacs.bugs as well.

> "Juanma Barranquero" <lekktu@gmail.com> writes:

> > Program received signal SIGSEGV, Segmentation fault.
> > 0x010c798a in run_composition_function (from=267, to=269, prop=520)
> >    at composite.c:456
> > 456       func = COMPOSITION_MODIFICATION_FUNC (prop);
> > (gdb) bt
> > #0  0x010c798a in run_composition_function (from=267, to=269, prop=520)
> >    at composite.c:456
> > #1  0x010c7d1c in update_compositions (from=269, to=271, check_mask=3)
> >    at composite.c:514

> The trouble here is that the code expects the property `prop' obtained
> from find_composition to be a valid composition, which is a cons.  So
> probably the way to fix this is to stick in a couple of
> COMPOSITION_VALID_P checks into update_compositions, around
> composite.c:514.

Thank you for finding this bug.  You are right.  I installed
a fix in the trunk.  Anyway, composition property should not
be attached manually as this:

(let ((s "text"))
   (put-text-property 0 2 'composition ?A s)
   (insert s))

Instead, people should use compose-region or compose-string
as this:

(insert (compose-string "text" 0 2 ?A))

> The strange thing, though, is that the elisp manual describes the
> composition property as follows (documented by Handa on 2007-04-19):

>   `composition'
>      This text property is used to display a sequence of characters as a
>      single glyph composed from components.  For instance, in Thai a
>      base consonant is composed with the following combining vowel as a
>      single glyph.  The value should be a character or a sequence
>      (vector, list, or string) of integers.

>         * If it is a character, it means to display that character
>           instead of the text in the region.

>         * If it is a string, it means to display that string's contents
>           instead of the text in the region.

>         * If it is a vector or list, the elements are characters
>           interleaved with internal codes specifying how to compose the
>           following character with the previous one.

> Is this a mistake?

Yes.  The above description is for the argument COMPONENTS
of the function `compose-region', or for just a part of the
property value.  The value has this form:

   The property value has this form when the composition is made:
	((LENGTH . COMPONENTS) . MODIFICATION-FUNC)
   then turns to this form:
	(COMPOSITION-ID . (LENGTH COMPONENTS-VEC . MODIFICATION-FUNC))
   when the composition is registered in composition_hash_table and
   composition_table.  These rather peculiar structures were designed
   to make it easy to distinguish them quickly (we can do that by
   checking only the first element) and to extract LENGTH (from the
   former form) and COMPOSITION-ID (from the latter form).
   [...]

The detail is described in the header comment of
src/composite.c.  How much detail, do you think, we should
describe in Info?

Isn't it enough to say just as below?

The value should be a cons of special structure.  It should
be manipulated only by the functions `compose-region',
`compose-string' and `find-composition'.

---
Kenichi Handa
handa@m17n.org

  reply	other threads:[~2007-06-14 12:32 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-11 16:32 Crash using text property 'composite on w32 Lennart Borgman (gmail)
2007-06-11 23:49 ` Jason Rumney
2007-06-11 23:58   ` Lennart Borgman (gmail)
2007-06-12  0:04     ` Jason Rumney
2007-06-12  0:07   ` Juanma Barranquero
2007-06-12  0:30     ` Lennart Borgman (gmail)
2007-06-12  3:19       ` Eli Zaretskii
2007-06-12 10:28         ` Lennart Borgman (gmail)
2007-06-12 15:44     ` Chong Yidong
2007-06-14 12:32       ` Kenichi Handa [this message]
2007-06-14 12:42         ` Lennart Borgman (gmail)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1HyoV8-0002KX-LC@etlken.m17n.org \
    --to=handa@m17n.org \
    --cc=cyd@stupidchicken.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.