r21680 by jghali - #14457: Crash when opening a specific file (due to notes/bullet list)

scribus-commit scribus-commit at lists.scribus.net
Mon Dec 26 19:39:15 UTC 2016


Author: jghali
Date: Mon Dec 26 19:39:15 2016
New Revision: 21680

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21680
Log:
#14457: Crash when opening a specific file (due to notes/bullet list)

Modified:
    trunk/Scribus/scribus/desaxe/digester.h
    trunk/Scribus/scribus/desaxe/digester_parse.cpp
    trunk/Scribus/scribus/pageitem_noteframe.cpp
    trunk/Scribus/scribus/util_text.cpp

Modified: trunk/Scribus/scribus/desaxe/digester.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21680&path=/trunk/Scribus/scribus/desaxe/digester.h
==============================================================================
--- trunk/Scribus/scribus/desaxe/digester.h	(original)
+++ trunk/Scribus/scribus/desaxe/digester.h	Mon Dec 26 19:39:15 2016
@@ -107,6 +107,7 @@
 
 	void parseFile(const Xml_string& filename);
 	void parseMemory(const char* data, unsigned int length);
+	void parseMemory(const Xml_string& data);
 
 	template<class ObjType>
 		ObjType*  result();	

Modified: trunk/Scribus/scribus/desaxe/digester_parse.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21680&path=/trunk/Scribus/scribus/desaxe/digester_parse.cpp
==============================================================================
--- trunk/Scribus/scribus/desaxe/digester_parse.cpp	(original)
+++ trunk/Scribus/scribus/desaxe/digester_parse.cpp	Mon Dec 26 19:39:15 2016
@@ -91,5 +91,16 @@
 	reader.parse( source );
 }
 
+void Digester::parseMemory(const Xml_string& data)
+{
+	DigesterParser handler(this);
+	QXmlInputSource source;
+	source.setData(data);
+	QXmlSimpleReader reader;
+	reader.setContentHandler( &handler );
+	reader.setErrorHandler( &handler );
+	reader.parse( source );
+}
+
 } // namespace
 

Modified: trunk/Scribus/scribus/pageitem_noteframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21680&path=/trunk/Scribus/scribus/pageitem_noteframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_noteframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_noteframe.cpp	Mon Dec 26 19:39:15 2016
@@ -262,7 +262,7 @@
 	mrk->setItemPtr(this);
 	mrk->setString(notesStyle()->prefix() + note->numString() + note->notesStyle()->suffix());
 
-	StoryText story;
+	StoryText story(m_Doc);
 	if (!note->saxedText().isEmpty())
 		story = desaxeString(m_Doc, note->saxedText());
 	story.insertMark(mrk, 0);

Modified: trunk/Scribus/scribus/util_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21680&path=/trunk/Scribus/scribus/util_text.cpp
==============================================================================
--- trunk/Scribus/scribus/util_text.cpp	(original)
+++ trunk/Scribus/scribus/util_text.cpp	Mon Dec 26 19:39:15 2016
@@ -59,14 +59,14 @@
 	assert(!saxedString.isEmpty());
 
 	Serializer* dig = doc->textSerializer();
-
-	QByteArray utf8Data = saxedString.toUtf8();
-	dig->parseMemory(utf8Data.constData(), utf8Data.length());
+	dig->parseMemory(saxedString);
 
 	StoryText* story = dig->result<StoryText>();
 	assert (story != NULL);
 
 	StoryText res = *story;
+	res.setDoc(doc);
+
 	delete story;
 	return res;
 }




More information about the scribus-commit mailing list