[cairo] UserFontFace vs FtFontFace management (cairomm)
jonathon at quotidian.org
Tue Dec 2 12:13:40 PST 2008
Ian Britten wrote:
> Hi all,
> [ NB - I'm pretty sure this is cairomm-specific ... ]
> Are users supposed to be able to create+manage UserFontFace
> objects the same way as FtFontFace objects? If yes, then I'm
> wondering about a crash I'm seeing...
> [ If no, then the docs should maybe clarify the difference ]
> I'm using libcairomm1.0_1-1.7.0-2mdv2008.1
> Given two cases like this:
> if ( /* some condition */ )
> Cairo::RefPtr<Cairo::UserFontFace> uFace(
> // this->holder.push_back(uFace);
> Cairo::RefPtr<Cairo::FtFontFace> fFace(
> In both cases, the FontFace is created, set on the context,
> then released. The context is a class member, and is only
> flushed/deleted later.
> - If I only go through the second (FT) case, there's no problems.
> - If I go through the first (User) case, I get a crash (or errors
> from Valgrind(*)) later on, when the context/surface is being
> - OTOH, if I go through the first case, but also maintain the
> constructed face in a std::list until later, then there is
> no problem.
> (*) The problem, as reported by Valgrind, seems to be that
> Cairo::UserFontFace::render_glyph_cb() (fontface.cc:287) is
> accessing something that was deleted in
> Cairo::UserFontFace::~UserFontFace()() (fontface.cc:330).
> [ I can provide full traces, if necessary ]
> It could be that I've missed something, or am doing something
> wrong (If so, pointers welcome!). I'm just gradually roughing
> in some of this stuff and hit this, so I figured I'd point it
> out. Lemme know if you need more details.
It's quite possible that you've hit a bug since this stuff was only implemented in cairomm
recently (and I've held off on releasing a stable 1.8.0 of cairomm precisely because this
stuff hasn't been well-tested yet). In fact, you're very likely the first person to have
tried to use it. I will look into it.
More information about the cairo