r14055 by mrdocs - patch commited for Herm fixing # 8256

scribus-commit scribus-commit at lists.scribus.net
Sun Sep 27 23:10:16 CEST 2009


Revision: 14055
Author: mrdocs
Date: 2009-09-27T21:11:24.207091Z
Commit message: patch commited for Herm fixing # 8256

Changeset: 
M  /branches/Version135/Scribus/scribus/latexhelpers.cpp

Diffs:
Index: scribus/latexhelpers.cpp
===================================================================
--- scribus/latexhelpers.cpp	(revision 14054)
+++ scribus/latexhelpers.cpp	(revision 14055)
@@ -38,6 +38,10 @@
 
 void LatexHighlighter::highlightBlock(const QString &text)
 {
+	//This is required to fix a QT incompatibility. See error message below for details.
+	static bool disable_highlighting = false;
+	if (disable_highlighting) return;
+
 	if (!rules) return;
 	foreach (LatexHighlighterRule *rule, *rules) {
 		int index = text.indexOf(rule->regex);
@@ -54,7 +58,15 @@
 				break;
 			}
 			setFormat(index, length, rule->format);
-			index = text.indexOf(rule->regex, index + length);
+			
+			int oldindex = index;
+			int offset = index + length;
+			index = text.indexOf(rule->regex, offset);
+			if (index >= 0 && (index == oldindex || index <= offset)) {
+				qWarning() << QObject::tr("Highlighter error: Invalid index returned by QT's QString.indexOf(). This is a incompatibility between different QT versions and it can only be fixed by recompiling Scribus with the same QT version that is running on this system. Syntax highlighting is disabled now, but render frames should continue to work without problems.") << "Additional debugging info: old index:" << oldindex << "new index:"<< index << "offset:" << offset;
+				disable_highlighting = true;
+				return;
+			}
 		}
 	}
 }




More information about the scribus-commit mailing list