r20407 by fschmid -

scribus-commit scribus-commit at lists.scribus.net
Sun Sep 20 09:05:13 UTC 2015


Author: fschmid
Date: Sun Sep 20 09:05:13 2015
New Revision: 20407

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20407
Log:
Fixed Bug #13290: Actions applied to "Empty Symbols" are very likely cause of crash

Modified:
    trunk/Scribus/scribus/pageitem_symbol.cpp
    trunk/Scribus/scribus/scpage.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/ui/symbolpalette.cpp

Modified: trunk/Scribus/scribus/pageitem_symbol.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20407&path=/trunk/Scribus/scribus/pageitem_symbol.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_symbol.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_symbol.cpp	Sun Sep 20 09:05:13 2015
@@ -55,8 +55,9 @@
 {
 	if (m_Doc->RePos)
 		return;
-
-	if ((patternVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternVal)))
+	if (!m_Doc->docPatterns.contains(patternVal))
+		patternVal = "";
+	if (patternVal.isEmpty())
 	{
 		if (m_Doc->guidesPrefs().framesShown)
 		{

Modified: trunk/Scribus/scribus/scpage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20407&path=/trunk/Scribus/scribus/scpage.cpp
==============================================================================
--- trunk/Scribus/scribus/scpage.cpp	(original)
+++ trunk/Scribus/scribus/scpage.cpp	Sun Sep 20 09:05:13 2015
@@ -441,7 +441,7 @@
 		oldItem->updatePolyClip();
 		m_Doc->AdjustItemSize(oldItem);
 		if (m_Doc->docPatterns.contains(patternName))
-			m_Doc->docPatterns.remove(patternName);
+			m_Doc->removePattern(patternName);
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20407&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Sun Sep 20 09:05:13 2015
@@ -3902,6 +3902,77 @@
 	return true;
 }
 
+void ScribusDoc::removePattern(QString name)
+{
+	docPatterns.remove(name);
+	QList<PageItem*> allItems;
+	for (int a = 0; a < DocItems.count(); ++a)
+	{
+		PageItem *currItem = DocItems.at(a);
+		if (currItem->isGroup())
+			allItems = currItem->asGroupFrame()->getItemList();
+		else
+			allItems.append(currItem);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			currItem = allItems.at(ii);
+			if (currItem->pattern() == name)
+				currItem->setPattern("");
+		}
+		allItems.clear();
+	}
+	for (int a = 0; a < MasterItems.count(); ++a)
+	{
+		PageItem *currItem = MasterItems.at(a);
+		if (currItem->isGroup())
+			allItems = currItem->asGroupFrame()->getItemList();
+		else
+			allItems.append(currItem);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			currItem = allItems.at(ii);
+			if (currItem->pattern() == name)
+				currItem->setPattern("");
+		}
+		allItems.clear();
+	}
+	for (QHash<int, PageItem*>::iterator itf = FrameItems.begin(); itf != FrameItems.end(); ++itf)
+	{
+		PageItem *currItem = itf.value();
+		if (currItem->isGroup())
+			allItems = currItem->asGroupFrame()->getItemList();
+		else
+			allItems.append(currItem);
+		for (int ii = 0; ii < allItems.count(); ii++)
+		{
+			currItem = allItems.at(ii);
+			if (currItem->pattern() == name)
+				currItem->setPattern("");
+		}
+		allItems.clear();
+	}
+	QStringList patterns = docPatterns.keys();
+	for (int c = 0; c < patterns.count(); ++c)
+	{
+		ScPattern pa = docPatterns[patterns[c]];
+		for (int o = 0; o < pa.items.count(); o++)
+		{
+			PageItem *currItem = pa.items.at(o);
+			if (currItem->isGroup())
+				allItems = currItem->asGroupFrame()->getItemList();
+			else
+				allItems.append(currItem);
+			for (int ii = 0; ii < allItems.count(); ii++)
+			{
+				currItem = allItems.at(ii);
+				if (currItem->pattern() == name)
+					currItem->setPattern("");
+			}
+			allItems.clear();
+		}
+	}
+}
+
 ScPattern* ScribusDoc::checkedPattern(QString &name)
 {
 	if (name.isEmpty() || !docPatterns.contains(name))
@@ -6723,7 +6794,7 @@
 		ScPage* addedPage = TempPages.at(0);
 		if (Items->count() == 0)
 		{
-			docPatterns.remove(currentEditedSymbol);
+			removePattern(currentEditedSymbol);
 		}
 		else
 		{

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20407&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h	(original)
+++ trunk/Scribus/scribus/scribusdoc.h	Sun Sep 20 09:05:13 2015
@@ -688,6 +688,7 @@
 	* @brief Set the patterns for a document
 	*/
 	bool addPattern(QString &name, ScPattern& pattern);
+	void removePattern(QString name);
 	void setPatterns(QHash<QString, ScPattern> &patterns);
 	/*!
 	* @brief Check pattern with specified name and return it if valid

Modified: trunk/Scribus/scribus/ui/symbolpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20407&path=/trunk/Scribus/scribus/ui/symbolpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/symbolpalette.cpp	(original)
+++ trunk/Scribus/scribus/ui/symbolpalette.cpp	Sun Sep 20 09:05:13 2015
@@ -289,7 +289,7 @@
 				{
 					if (m_doc->docPatterns.contains(it->text()))
 					{
-						m_doc->docPatterns.remove(it->text());
+						m_doc->removePattern(it->text());
 						updateSymbolList();
 						e->accept();
 					}




More information about the scribus-commit mailing list