r23677 by jghali - Prevent potential crash in case of broken note frame

scribus-commit scribus-commit at lists.scribus.net
Sun May 3 14:32:18 UTC 2020


Author: jghali
Date: Sun May  3 14:32:18 2020
New Revision: 23677

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23677
Log:
Prevent potential crash in case of broken note frame

Modified:
    trunk/Scribus/scribus/canvasmode_edit.cpp

Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23677&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp	Sun May  3 14:32:18 2020
@@ -20,6 +20,7 @@
 #include <QButtonGroup>
 #include <QCheckBox>
 #include <QCursor>
+#include <QDebug>
 #include <QEvent>
 #include <QMessageBox>
 #include <QMouseEvent>
@@ -29,7 +30,6 @@
 #include <QRect>
 #include <QTimer>
 #include <QWidgetAction>
-#include <QDebug>
 
 #include "appmodes.h"
 #include "canvas.h"
@@ -138,11 +138,15 @@
 		currItem->handleModeEditKey(e, m_keyRepeat);
 		if (currItem->isAutoNoteFrame() && currItem->asNoteFrame()->notesList().isEmpty())
 		{
-			if (!currItem->asNoteFrame()->isEndNotesFrame())
-			{
-				currItem->asNoteFrame()->masterFrame()->invalidateLayout(false);
-				currItem->asNoteFrame()->masterFrame()->updateLayout();
-			}
+			PageItem_NoteFrame* noteFrame = currItem->asNoteFrame();
+			if (!noteFrame->isEndNotesFrame() && noteFrame->masterFrame())
+			{
+				PageItem_TextFrame* masterFrame = noteFrame->masterFrame();
+				masterFrame->invalidateLayout(false);
+				masterFrame->updateLayout();
+			}
+			else if (!noteFrame->isEndNotesFrame() && !noteFrame->masterFrame())
+				qDebug() << "Broken note frame without master frame detected";
 		}
 		m_keyRepeat = oldKeyRepeat;
 		m_doc->regionsChanged()->update(QRectF());




More information about the scribus-commit mailing list