r22149 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Aug 29 21:29:43 UTC 2017


Author: jghali
Date: Tue Aug 29 21:29:43 2017
New Revision: 22149

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22149
Log:
#14968: Crash on deleting Table Row/ Column

Modified:
    trunk/Scribus/scribus/pageitem_table.cpp

Modified: trunk/Scribus/scribus/pageitem_table.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22149&path=/trunk/Scribus/scribus/pageitem_table.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_table.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_table.cpp	Tue Aug 29 21:29:43 2017
@@ -1120,14 +1120,20 @@
 	TableCell newActiveCell = validCell(cell.row(), cell.column()) ? cell : cellAt(0, 0);
 
 	// Deselect previous active cell and its text.
-	m_activeCell.textFrame()->setSelected(false);
-	m_activeCell.textFrame()->itemText.deselectAll();
-	m_activeCell.textFrame()->HasSel = false;
+	PageItem_TextFrame* textFrame = m_activeCell.textFrame();
+	textFrame->setSelected(false);
+	textFrame->itemText.deselectAll();
+	textFrame->HasSel = false;
+
+	// Set current style context befor assigning new active cell:
+	// if old active cell ref count is 1, the old context might be deleted
+	const ParagraphStyle& curStyle = newActiveCell.textFrame()->currentStyle();
+	m_Doc->currentStyle.setContext(curStyle.context());
+	m_Doc->currentStyle = newActiveCell.textFrame()->currentStyle();
 
 	// Set the new active cell and select it.
 	m_activeCell = newActiveCell;
 	m_activeCell.textFrame()->setSelected(true);
-	m_Doc->currentStyle = m_activeCell.textFrame()->currentStyle();
 	m_activeRow = m_activeCell.row();
 	m_activeColumn = m_activeCell.column();
 	emit selectionChanged();




More information about the scribus-commit mailing list