r16691 by jghali - #10072 : loop on file save caused by broken style hierarchy

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 25 13:09:18 UTC 2011


Author: jghali
Date: Sat Jun 25 13:09:18 2011
New Revision: 16691

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16691
Log:
#10072 : loop on file save caused by broken style hierarchy

Modified:
    branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
    branches/Version135/Scribus/scribus/scribusdoc.cpp

Modified: branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16691&path=/branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ branches/Version135/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Sat Jun 25 13:09:18 2011
@@ -1783,6 +1783,11 @@
 		newStyle.setDefaultStyle(false);
 
 	GetCharStyle(&it, doc, newStyle);
+
+	// Check that a style is not its own parent
+	QString parentStyle = newStyle.parent();
+	if (parentStyle == newStyle.name())
+		newStyle.setParent(QString());
 }
 
 void Scribus134Format::GetItemText(QDomElement *it, ScribusDoc *doc, PageItem* obj, LastStyles* last, bool impo, bool VorLFound)
@@ -1983,14 +1988,16 @@
 		vg.setDefaultStyle(true);
 	else
 		vg.setDefaultStyle(false);
+
 	QString parentStyle = pg.attribute("PARENT", "");
-	if (!parentStyle.isEmpty())
+	if (!parentStyle.isEmpty() && (parentStyle != vg.name()))
 	{
 		if (m_Doc->styleExists(parentStyle))
 			vg.setParent(parentStyle);
 		else
 			vg.setParent(CommonStrings::DefaultParagraphStyle);
 	}
+
 	if (pg.hasAttribute("LINESPMode"))
 		vg.setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(pg.attribute("LINESPMode").toInt()));
 	if (pg.hasAttribute("LINESP"))

Modified: branches/Version135/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16691&path=/branches/Version135/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version135/Scribus/scribus/scribusdoc.cpp Sat Jun 25 13:09:18 2011
@@ -933,9 +933,10 @@
 		}
 
 		QList<int> retList2;
-		QString par = docParagraphStyles[ff].parent();
+		QString name = docParagraphStyles[ff].name();
+		QString par  = docParagraphStyles[ff].parent();
 		retList2.prepend(ff);
-		while (!par.isEmpty())
+		while ((!par.isEmpty()) && (par != name))
 		{
 			int pp = docParagraphStyles.find(par);
 			if ((pp >= 0) && (!retList2.contains(pp)))
@@ -964,9 +965,10 @@
 		}
 
 		QList<int> retList2;
-		QString par = docCharStyles[ff].parent();
+		QString name = docCharStyles[ff].name();
+		QString par  = docCharStyles[ff].parent();
 		retList2.prepend(ff);
-		while (!par.isEmpty())
+		while ((!par.isEmpty()) && (par != name))
 		{
 			int pp = docCharStyles.find(par);
 			if ((pp >= 0) && (!retList2.contains(pp)))




More information about the scribus-commit mailing list