r18362 by jghali - #11656: Crash/Block while changing simultaneously a text and an image frame level

scribus-commit scribus-commit at lists.scribus.net
Wed Jul 10 19:24:10 UTC 2013


Author: jghali
Date: Wed Jul 10 19:24:10 2013
New Revision: 18362

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18362
Log:
#11656: Crash/Block while changing simultaneously a text and an image frame level

Modified:
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18362&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Jul 10 19:24:10 2013
@@ -7484,7 +7484,7 @@
 		}
 	}
 	PageItem *currItem;
-	QMap<int, objOrdHelper> ObjOrder;
+	QMap<int, objOrdHelper> objOrder;
 	int d;
 	for (int c = 0; c < docSelectionCount; ++c)
 	{
@@ -7497,29 +7497,31 @@
 			{
 				d = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
 				oHlp.parent = currItem->Parent;
-				ObjOrder.insert(d, oHlp);
-				currItem->Parent->asGroupFrame()->groupItemList.takeAt(d);
-			}
+				objOrder.insert(d, oHlp);
+			}
+		}
+		else if (Items->count() > 1)
+		{
+			d = Items->indexOf(currItem);
+			oHlp.parent = NULL;
+			objOrder.insert(d, oHlp);
+		}
+	}
+	QList<objOrdHelper> objIndex = objOrder.values();
+	for (int c = objIndex.count() - 1; c > -1; c--)
+	{
+		objOrdHelper oHlp = objIndex[c];
+		PageItem* objItem = m_Selection->itemAt(oHlp.objNrSel);
+		if (oHlp.parent == NULL)
+		{
+			Items->removeOne(objItem);
+			Items->prepend(objItem);
 		}
 		else
 		{
-			if (Items->count() > 1)
-			{
-				d = Items->indexOf(currItem);
-				oHlp.parent = NULL;
-				ObjOrder.insert(d, oHlp);
-				Items->takeAt(d);
-			}
-		}
-	}
-	QList<objOrdHelper> Oindex = ObjOrder.values();
-	for (int c = static_cast<int>(Oindex.count()-1); c > -1; c--)
-	{
-		objOrdHelper oHlp = Oindex[c];
-		if (oHlp.parent == NULL)
-			Items->prepend(m_Selection->itemAt(oHlp.objNrSel));
-		else
-			oHlp.parent->asGroupFrame()->groupItemList.prepend(m_Selection->itemAt(oHlp.objNrSel));
+			oHlp.parent->asGroupFrame()->groupItemList.removeOne(objItem);
+			oHlp.parent->asGroupFrame()->groupItemList.prepend(objItem);
+		}
 	}
 	changed();
 	regionsChanged()->update(QRectF());
@@ -7548,7 +7550,7 @@
 		}
 	}
 	PageItem *currItem;
-	QMap<int, objOrdHelper> ObjOrder;
+	QMap<int, objOrdHelper> objOrder;
 	int d;
 	for (int c = 0; c < docSelectionCount; ++c)
 	{
@@ -7561,29 +7563,31 @@
 			{
 				d = currItem->Parent->asGroupFrame()->groupItemList.indexOf(currItem);
 				oHlp.parent = currItem->Parent;
-				ObjOrder.insert(d, oHlp);
-				currItem->Parent->asGroupFrame()->groupItemList.takeAt(d);
-			}
+				objOrder.insert(d, oHlp);
+			}
+		}
+		else if (Items->count() > 1)
+		{
+			d = Items->indexOf(currItem);
+			oHlp.parent = NULL;
+			objOrder.insert(d, oHlp);
+		}
+	}
+	QList<objOrdHelper> objIndex = objOrder.values();
+	for (int c = 0; c < objIndex.count(); ++c)
+	{
+		objOrdHelper oHlp = objIndex[c];
+		PageItem* objItem = m_Selection->itemAt(oHlp.objNrSel);
+		if (oHlp.parent == NULL)
+		{
+			Items->removeOne(objItem);
+			Items->append(objItem);
 		}
 		else
 		{
-			if (Items->count() > 1)
-			{
-				d = Items->indexOf(currItem);
-				oHlp.parent = NULL;
-				ObjOrder.insert(d, oHlp);
-				Items->takeAt(d);
-			}
-		}
-	}
-	QList<objOrdHelper> Oindex = ObjOrder.values();
-	for (int c = 0; c <static_cast<int>(Oindex.count()); ++c)
-	{
-		objOrdHelper oHlp = Oindex[c];
-		if (oHlp.parent == NULL)
-			Items->append(m_Selection->itemAt(oHlp.objNrSel));
-		else
+			oHlp.parent->asGroupFrame()->groupItemList.removeOne(objItem);
 			oHlp.parent->asGroupFrame()->groupItemList.append(m_Selection->itemAt(oHlp.objNrSel));
+		}
 	}
 	changed();
 	regionsChanged()->update(QRectF());




More information about the scribus-commit mailing list