r19897 by jghali - #12938: Changing "Copy Page" destination crashes Scribus

scribus-commit scribus-commit at lists.scribus.net
Tue Mar 3 19:39:02 UTC 2015


Author: jghali
Date: Tue Mar  3 19:39:02 2015
New Revision: 19897

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19897
Log:
#12938: Changing "Copy Page" destination crashes Scribus

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

Modified: trunk/Scribus/scribus/ui/movepage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19897&path=/trunk/Scribus/scribus/ui/movepage.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/movepage.cpp (original)
+++ trunk/Scribus/scribus/ui/movepage.cpp Tue Mar  3 19:39:02 2015
@@ -45,6 +45,10 @@
 	fromToLayout->addWidget( moveLabel, currentRow, 0);
 	fromToLayout->addWidget( fromPageData, currentRow, 1);
 
+	toLabel = 0;
+	toPageData = 0;
+	numberOfCopiesLabel = 0;
+	numberOfCopiesData  = 0;
 	if (move)
 	{
 		toLabel = new QLabel( tr("To:"), this );
@@ -107,28 +111,31 @@
 
 	// signals and slots connections
 	if (move)
+	{
+		connect( fromPageData, SIGNAL( valueChanged(double) ), this, SLOT( fromChanged() ) );
 		connect( toPageData, SIGNAL( valueChanged(double) ), this, SLOT( toChanged() ) );
+	}
 	connect( mvWhereData, SIGNAL( activated(int) ), this, SLOT( mvWherePageDataDisable(int) ) );
-	connect( fromPageData, SIGNAL( valueChanged(double) ), this, SLOT( fromChanged() ) );
 	connect( okButton, SIGNAL( clicked() ), this, SLOT( accept() ) );
 	connect( cancelButton, SIGNAL( clicked() ), this, SLOT( reject() ) );
 }
 
 void MovePages::fromChanged()
 {
-	if (move)
-	{
-		int pageNumber=static_cast<int>(fromPageData->value());
-		if (pageNumber > toPageData->value() || mvWhereData->currentIndex() == 3)
-			toPageData->setValue(pageNumber);
-		if ((pageNumber == 1) && (toPageData->value() == toPageData->maximum()))
-			toPageData->setValue(toPageData->maximum()-1);
-	}
+	if (!move)
+		return;
+	int pageNumber = static_cast<int>(fromPageData->value());
+	if (pageNumber > toPageData->value() || mvWhereData->currentIndex() == 3)
+		toPageData->setValue(pageNumber);
+	if ((pageNumber == 1) && (toPageData->value() == toPageData->maximum()))
+		toPageData->setValue(toPageData->maximum()-1);
 }
 
 void MovePages::toChanged()
 {
-	int pageNumber=static_cast<int>(toPageData->value());
+	if (!move)
+		return;
+	int pageNumber = static_cast<int>(toPageData->value());
 	if (pageNumber < fromPageData->value())
 		fromPageData->setValue(pageNumber);
 	if ((fromPageData->value() == 1) && (pageNumber == toPageData->maximum()))
@@ -138,9 +145,12 @@
 void MovePages::mvWherePageDataDisable(int index)
 {
 	mvWherePageData->setDisabled(index==2);
-	toPageData->setDisabled(index==3);
-	if (index==3)
-		toPageData->setValue(fromPageData->value());
+	if (toPageData)
+	{
+		toPageData->setDisabled(index==3);
+		if (index==3)
+			toPageData->setValue(fromPageData->value());
+	}
 }
 
 




More information about the scribus-commit mailing list