r19648 by jghali - #12832: Setting Fill Shade of Cell/Char to "Parent Value" crashes Scribus

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 26 23:05:57 UTC 2014


Author: jghali
Date: Wed Nov 26 23:05:57 2014
New Revision: 19648

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19648
Log:
#12832: Setting Fill Shade of Cell/Char to "Parent Value" crashes Scribus

Modified:
    trunk/Scribus/scribus/ui/smshadebutton.cpp
    trunk/Scribus/scribus/ui/smshadebutton.h

Modified: trunk/Scribus/scribus/ui/smshadebutton.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19648&path=/trunk/Scribus/scribus/ui/smshadebutton.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smshadebutton.cpp (original)
+++ trunk/Scribus/scribus/ui/smshadebutton.cpp Wed Nov 26 23:05:57 2014
@@ -51,11 +51,17 @@
 	{
 		setValue(m_pValue, true);
 		QList<QAction*> actList = FillSh->actions();
-		FillSh->removeAction(actList.last());
+		if (actList.last()->text() == useParentValueText())
+			FillSh->removeAction(actList.last());
 	}
-	
 
 	return ret;
+}
+
+QString SMShadeButton::useParentValueText()
+{
+	QString trText = tr("Use Parent Value");
+	return trText;
 }
 
 void SMShadeButton::setFont(bool wantBold)
@@ -71,7 +77,7 @@
 	if (m_hasParent)
 	{
 		setFont(true);
-		QString upv = tr("Use Parent Value");
+		QString upv = useParentValueText();
 		QList<QAction*> actList = FillSh->actions();
 		if (actList.last()->text() != upv)
 			FillSh->addAction(upv, this, SLOT(slotUseParent()));
@@ -82,6 +88,7 @@
 {
 	m_useParentValue = true;
 	QList<QAction*> actList = FillSh->actions();
-	FillSh->removeAction(actList.last());
+	if (actList.last()->text() == useParentValueText())
+		FillSh->removeAction(actList.last());
 	emit clicked();
 }

Modified: trunk/Scribus/scribus/ui/smshadebutton.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19648&path=/trunk/Scribus/scribus/ui/smshadebutton.h
==============================================================================
--- trunk/Scribus/scribus/ui/smshadebutton.h (original)
+++ trunk/Scribus/scribus/ui/smshadebutton.h Wed Nov 26 23:05:57 2014
@@ -28,6 +28,8 @@
 	bool   m_hasParent;
 	bool   m_useParentValue;
 	int    m_pValue;
+
+	QString useParentValueText();
 	void setFont(bool wantBold);
 
 private slots:




More information about the scribus-commit mailing list