[cairo] Pango:Attribute set_start_index(0) crash

猛 郝 mhao1999 at live.cn
Thu Sep 23 10:02:19 UTC 2021


solved, should create a specific type of Attribute instead of base class. like Pango::AttrColor
________________________________
From: cairo <cairo-bounces at cairographics.org> on behalf of mhao1999 at live.cn <mhao1999 at live.cn>
Sent: Wednesday, September 22, 2021 11:19 PM
To: cairo at cairographics.org <cairo at cairographics.org>
Subject: [cairo] Pango:Attribute set_start_index(0) crash

I want to apply foreground color to each of string "the" like below using pangomm:
     auto layout = create_pango_layout("the");

  layout->set_font_description(font);

  Pango::AttrList attrlist;

  Pango::Attribute attr1;

  attr1.create_attr_foreground(255, 0, 0);

  attr1.set_start_index(0);

  attr1.set_end_index(1);

  attrlist.insert(attr1);


  Pango::Attribute attr2;

  attr2.create_attr_foreground(0, 255, 0);

  attr2.set_start_index(1);

  attr2.set_end_index(2);

  attrlist.insert(attr2);


  Pango::Attribute attr3;

  attr3.create_attr_foreground(0, 0, 255);

  attr3.set_start_index(2);

  attr3.set_end_index(3);

  attrlist.insert(attr3);

When I debug using Qt creator, step over attr1.set_start_index(0), it crash, says:
"The inferior stopped because it received a signal from the operating system.
Signal name: SIGSEGV
Signal meaning: Segmentation fault

Anybody can shed a light on it, thanks!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.cairographics.org/archives/cairo/attachments/20210923/559e7cae/attachment.htm>


More information about the cairo mailing list