r15225 by jghali - fix crash on exit after cancelling svg export dialog (2)

scribus-commit scribus-commit at lists.scribus.net
Sat Jun 19 00:21:02 CEST 2010


Revision: 15225
Author: jghali
Date: 2010-06-18T22:19:20.484483Z
Commit message: fix crash on exit after cancelling svg export dialog (2)

Changeset: 
M  /trunk/Scribus/scribus/plugins/svgexplugin/svgexplugin.cpp

Diffs:
Index: scribus/plugins/svgexplugin/svgexplugin.cpp
===================================================================
--- scribus/plugins/svgexplugin/svgexplugin.cpp	(revision 15224)
+++ scribus/plugins/svgexplugin/svgexplugin.cpp	(revision 15225)
@@ -142,42 +142,38 @@
 		exportBack->setToolTip( tr("Adds the Page itself as background to the SVG."));
 		exportBack->setChecked(false);
 		openDia->addWidgets(exportBack);
-		if (openDia->exec())
-		{
-			fileName = openDia->selectedFile();
-			QFileInfo fi(fileName);
-			QString baseDir = fi.absolutePath();
-			if (compress->isChecked())
-				fileName = baseDir + "/" + fi.baseName() + ".svgz";
-			else
-				fileName = baseDir + "/" + fi.baseName() + ".svg";
-		}
-		else
+		
+		if (!openDia->exec())
 			return true;
+		fileName = openDia->selectedFile();
+		QFileInfo fi(fileName);
+		QString baseDir = fi.absolutePath();
+		if (compress->isChecked())
+			fileName = baseDir + "/" + fi.baseName() + ".svgz";
+		else
+			fileName = baseDir + "/" + fi.baseName() + ".svg";
+
 		SVGOptions Options;
 		Options.inlineImages = inlineImages->isChecked();
 		Options.exportPageBackground = exportBack->isChecked();
 		Options.compressFile = compress->isChecked();
 		openDia.clear();
 
-		if (!fileName.isEmpty())
+		if (fileName.isEmpty())
+			return true;
+		prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
+		QFile f(fileName);
+		if (f.exists())
 		{
-			prefs->set("wdir", fileName.left(fileName.lastIndexOf("/")));
-			QFile f(fileName);
-			if (f.exists())
-			{
-				int exit = QMessageBox::warning(doc->scMW(), CommonStrings::trWarning,
-					QObject::tr("Do you really want to overwrite the file:\n%1 ?").arg(fileName),
-					QMessageBox::Yes | QMessageBox::No);
-				if (exit == QMessageBox::No)
-					return true;
-			}
-			SVGExPlug *dia = new SVGExPlug(doc);
-			dia->doExport(fileName, Options);
-			delete dia;
+			int exit = QMessageBox::warning(doc->scMW(), CommonStrings::trWarning,
+				QObject::tr("Do you really want to overwrite the file:\n%1 ?").arg(fileName),
+				QMessageBox::Yes | QMessageBox::No);
+			if (exit == QMessageBox::No)
+				return true;
 		}
-		else
-			return true;
+		SVGExPlug *dia = new SVGExPlug(doc);
+		dia->doExport(fileName, Options);
+		delete dia;
 	}
 	return true;
 }




More information about the scribus-commit mailing list