https://bugs.kde.org/show_bug.cgi?id=381428
--- Comment #4 from Mikael Rosbacke <mikael.rosba...@gmail.com> --- Been investigating this as a step to get to know the Krita code base. Used master at 2017-09-08 and commit 91be09796c57f642020f2e75720e04eb318c96b4. Can confirm the crash. Culprit is SVG parsing of the 'use' elements. The function KoShape* SvgParser::parseUse(const KoXmlElement &e) can return nullptr which gets inserted into the 'shapes' list and later generate the SIGSEGV. Simple fix is to check for nullptr before inserting. However this is not a full fix. It would mean losing data as the use element refer to some element that has not yet been defined. What would be needed is to delay evaluation of the use element until the point where its reference is available. Another solution is to implement a 2-pass parsing. This is a bit much for an initial look at a new codebase. Thought I'd at least document my findings here. The following snippet should fix the crash it but will lose data: I've also attached a bit longer diff with some more asserts and debug output when problem arrives. @@ -1404,7 +1428,10 @@ QList<KoShape*> SvgParser::parseSingleElement(const KoXmlElement &b) if (shape) shapes.append(shape); } else if (b.tagName() == "use") { - shapes += parseUse(b); + KoShape *shape = parseUse(b); + if (shape) { + shapes.append(shape); + } } else if (b.tagName() == "color-profile") { m_context.parseProfile(b); } else { -- You are receiving this mail because: You are watching all bug changes.