r21755 by jghali - fix potential crash when deleting note frames

scribus-commit scribus-commit at lists.scribus.net
Mon Feb 6 23:30:12 UTC 2017


Author: jghali
Date: Mon Feb  6 23:30:12 2017
New Revision: 21755

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21755
Log:
fix potential crash when deleting note frames

Modified:
    trunk/Scribus/scribus/pageitem_textframe.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21755&path=/trunk/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_textframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_textframe.cpp	Mon Feb  6 23:30:12 2017
@@ -5761,7 +5761,9 @@
 	{
 		if (nF->deleteIt || (nF->isAutoNoteFrame() && !notesMap.keys().contains(nF)))
 		{
-			m_Doc->delNoteFrame(nF,true);
+			m_Doc->delNoteFrame(nF, true);
+			m_notesFramesMap.remove(nF);
+			notesMap.remove(nF);
 			docWasChanged = true;
 		}
 		else

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21755&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Mon Feb  6 23:30:12 2017
@@ -18018,7 +18018,7 @@
 		if (m->isType(MARK2ItemType) && (m->getItemPtr() == nF))
 		{
 			setUndoDelMark(m);
-			eraseMark(m,true);
+			eraseMark(m, true);
 		}
 	}
 	m_Selection->delaySignalsOn();
@@ -18033,6 +18033,19 @@
 	m_Selection->delaySignalsOff();
 
 	Items->removeOne(nF);
+
+	QList<PageItem*> allItems = *Items;
+	while (allItems.count() > 0)
+	{
+		PageItem* item = allItems.takeFirst();
+		if (item->isGroup() || item->isTable())
+		{
+			allItems = item->getItemList() + allItems;
+			continue;
+		}
+		if (item->isTextFrame())
+			item->asTextFrame()->removeNoteFrame(nF);
+	}
 	setNotesChanged(true);
 	if (forceDeletion)
 		delete nF;




More information about the scribus-commit mailing list