r19331 by jghali - #12479: Closing Scribus with multiple master pages open simultaneously triggers crash

scribus-commit scribus-commit at lists.scribus.net
Mon Jul 7 22:32:49 UTC 2014


Author: jghali
Date: Mon Jul  7 22:32:49 2014
New Revision: 19331

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19331
Log:
#12479: Closing Scribus with multiple master pages open simultaneously triggers crash

Modified:
    trunk/Scribus/scribus/ui/pagepalette.cpp

Modified: trunk/Scribus/scribus/ui/pagepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19331&path=/trunk/Scribus/scribus/ui/pagepalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette.cpp Mon Jul  7 22:32:49 2014
@@ -12,6 +12,7 @@
 #include <QPainter>
 #include <QStackedWidget>
 
+#include "appmodes.h"
 #include "commonstrings.h"
 #include "pagelayout.h"
 #include "pagepalette.h"
@@ -162,7 +163,20 @@
 
 void PagePalette::startMasterPageMode(QString masterPage)
 {
-	m_view->Deselect(true);
+	ScribusDoc* doc = m_view->Doc;
+	
+	bool mustDeselect = false;
+	mustDeselect |= (!doc->masterPageMode());
+	mustDeselect |= (doc->masterPageMode() && doc->currentPage()->pageName() != masterPage);
+	if (mustDeselect)
+	{
+		// We must avoid deselecting directly if doc is in an edit mode,
+		// otherwise that would cause an inconsistent state. In such case,
+		// fallback to normal mode by precaution
+		if (doc->appMode != modeNormal)
+			m_view->requestMode(modeNormal);
+		m_view->Deselect(true);
+	}
 
 	QStackedWidget* stackedWidget = this->stackedWidget();
 	if (stackedWidget->count() < 2)




More information about the scribus-commit mailing list