[cairo] Pango:Attribute set_start_index(0) crash

mhao1999 at live.cn mhao1999 at live.cn
Wed Sep 22 15:19:47 UTC 2021


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/20210922/df61cfa4/attachment.htm>


More information about the cairo mailing list