r18268 by jghali - fix crash when loading documents containing tables with text in several cells

scribus-commit scribus-commit at lists.scribus.net
Sun Apr 28 12:20:42 UTC 2013


Author: jghali
Date: Sun Apr 28 12:20:42 2013
New Revision: 18268

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18268
Log:
fix crash when loading documents containing tables with text in several cells

Modified:
    trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp

Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18268&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Sun Apr 28 12:20:42 2013
@@ -5215,7 +5215,7 @@
 		item->setFillColor(fColor);
 	item->setFillShade(attrs.valueAsInt("FillShade", 100));
 	QStringRef tagName = reader.name();
-	LastStyles * lastStyle = new LastStyles();
+	LastStyles lastStyle;
 	doc->dontResize = true;
 	while (!reader.atEnd() && !reader.hasError())
 	{
@@ -5227,6 +5227,7 @@
 			ScXmlStreamAttributes tAtt = reader.scAttributes();
 			int row = tAtt.valueAsInt("Row", -1);
 			int col = tAtt.valueAsInt("Column", -1);
+			lastStyle = LastStyles();
 			if ((row >= 0) && (col >= 0))
 			{
 				if (tAtt.hasAttribute("Style"))
@@ -5337,7 +5338,7 @@
 				else if (reader.name() == "ITEXT")
 				{
 					ScXmlStreamAttributes tAttT = reader.scAttributes();
-					readItemText(item->cellAt(row, col).textFrame(), tAttT, lastStyle);
+					readItemText(item->cellAt(row, col).textFrame(), tAttT, &lastStyle);
 				}
 				else if (reader.name() == "para")
 				{
@@ -5346,7 +5347,7 @@
 					ParagraphStyle newStyle;
 					readParagraphStyle(doc, reader, newStyle);
 					newItem->itemText.setStyle(newItem->itemText.length()-1, newStyle);
-					newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, lastStyle->Style);
+					newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, lastStyle.Style);
 				}
 				else if (reader.name() == "trail")
 				{
@@ -5362,8 +5363,8 @@
 					newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::TAB);
 					readCharacterStyleAttrs(doc, tAtt, newStyle);
 					newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, newStyle);
-					lastStyle->StyleStart = newItem->itemText.length()-1;
-					lastStyle->Style = newStyle;
+					lastStyle.StyleStart = newItem->itemText.length()-1;
+					lastStyle.Style = newStyle;
 				}
 				else if (reader.name() == "breakline")
 				{
@@ -5410,8 +5411,8 @@
 						newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::PAGECOUNT);
 					readCharacterStyleAttrs(doc, tAtt, newStyle);
 					newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, newStyle);
-					lastStyle->StyleStart = newItem->itemText.length()-1;
-					lastStyle->Style = newStyle;
+					lastStyle.StyleStart = newItem->itemText.length()-1;
+					lastStyle.Style = newStyle;
 				}
 			}
 		}




More information about the scribus-commit mailing list