r16813 by jghali - #10234: new table is not added to undo history...which leads to crash

scribus-commit scribus-commit at lists.scribus.net
Fri Sep 2 22:17:01 UTC 2011


Author: jghali
Date: Fri Sep  2 22:17:01 2011
New Revision: 16813

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16813
Log:
#10234: new table is not added to undo history...which leads to crash

Modified:
    branches/Version135/Scribus/scribus/canvasmode_create.cpp

Modified: branches/Version135/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16813&path=/branches/Version135/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/canvasmode_create.cpp (original)
+++ branches/Version135/Scribus/scribus/canvasmode_create.cpp Fri Sep  2 22:17:01 2011
@@ -374,7 +374,16 @@
 
 	m_createTransaction = new UndoTransaction(Um::instance()->beginTransaction("creating"));
 	currItem = doCreateNewObject();
-	if (m_createTransaction && currItem)
+	if (m_createTransaction && currItem && currItem->isGroupControl)
+	{
+		// We created a table, just commit transaction
+		m_view->resetMousePressed();
+		m_createTransaction->commit();
+		m_doc->changed();
+		delete m_createTransaction;
+		m_createTransaction = NULL;	
+	}
+	else if (m_createTransaction && currItem)
 	{
 		m_view->resetMousePressed();
 		currItem->checkChanges(true);
@@ -767,7 +776,6 @@
 			canvasCurrCoord.setXY(qRound(Tw), qRound(Th));
 			Tw = Tw - Tx;
 			Th = Th - Ty;
-			int z;
 			int Cols, Rows;
 			double deltaX, deltaY, offX, offY;
 			if ((Th < 6) || (Tw < 6))
@@ -794,10 +802,10 @@
 			offY = 0.0;
 			m_doc->m_Selection->clear();
 			if (UndoManager::undoEnabled())
-				activeTransaction = new UndoTransaction(m_view->undoManager->beginTransaction(m_doc->currentPage()->getUName(),
-																						  Um::ITable, Um::CreateTable,
-																						  QString(Um::RowsCols).arg(Rows).arg(Cols),
-																						  Um::ICreate));
+				activeTransaction = new UndoTransaction(Um::instance()->beginTransaction(m_doc->currentPage()->getUName(),
+																						 Um::ITable, Um::CreateTable,
+																						 QString(Um::RowsCols).arg(Rows).arg(Cols),
+																						 Um::ICreate));
 			m_doc->m_Selection->delaySignalsOn();
 			for (int rc = 0; rc < Rows; ++rc)
 			{
@@ -837,6 +845,7 @@
 				}
 			}
 			m_doc->itemSelection_GroupObjects(false, false);
+			z = (m_doc->Items->count() - 1) - Rows * Cols;
 			if (activeTransaction)
 			{
 				activeTransaction->commit();




More information about the scribus-commit mailing list