Comment 6 for bug 1502432

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote : Re: Crash on load if <symbol> includes <text> and <svg> lacks 'viewBox' (pango >= 1.38)

The crash is a result of font_feature_settings.value having a NULL value in the comparison in SPStyle::getFontFeatureString().

This is called in Layout-TNG-Compute.cpp by Layout::Calculator::_buildPangoItemizationForPara(ParagraphInfo *para) but only if PANGO_VERSION_CHECK(1,37,1) is true.

Why this would have anything to do with the SVG 'viewBox' is missing is really strange.

Looking at the traceback SPText::rebuildLayout() is called in SPText::write(). There should be no reason to call this function here. A write should not require rebuilding the text layout. Commenting out this line gets rid of the crash. A comment says that this was put in as a fix for LP Bug 1339305 but there is no explanation of why this would fix that problem... seems like a classic case of "Cargo Cult Programming".

Going back further, the whole "write" chain is started in sp_file_open() when a document without a 'viewBox' attribute is given one (this is probably not necessary... we probably should not be adding 'viewBox' where one doesn't already exist... especially basing it off of the display unit). So this explains why a document without a 'viewBox' is crashing on load.

Now, why would text in a symbol cause trouble? It is different from normal text in that symbols are not rendered directly. Styling may not be fully resolved at this point (just a guess). Needs further investigation.