r14001 by fschmid - Fixed another crash when closing documents.

scribus-commit scribus-commit at lists.scribus.net
Sat Sep 19 12:45:18 CEST 2009


Revision: 14001
Author: fschmid
Date: 2009-09-19T10:43:09.336066Z
Commit message: Fixed another crash when closing documents.

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

Diffs:
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 14000)
+++ scribus/scribus.cpp	(revision 14001)
@@ -1942,15 +1942,19 @@
 		uint windowCount=windows.count();
 		for ( uint i = 0; i < windowCount; ++i )
 		{
-			newActWin(windows.at(i));
-			tw = ActWin;
-			slotSelect();
-			ActWin->close();
-			if (tw == ActWin)
+			tw = dynamic_cast<ScribusWin *>(windows.at(i));
+			if (tw)
 			{
-				ce->ignore();
-				connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *)));
-				return;
+				newActWin(windows.at(i));
+				tw = ActWin;
+				slotSelect();
+				ActWin->close();
+				if (tw == ActWin)
+				{
+					ce->ignore();
+					connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow *)), this, SLOT(newActWin(QMdiSubWindow *)));
+					return;
+				}
 			}
 		}
 	}
@@ -2477,11 +2481,14 @@
 		ScribusWin* swin;
 		for ( int i = 0; i < static_cast<int>(windows.count()); ++i )
 		{
-			swin = (ScribusWin*)windows.at(i)->widget();
-			if (swin==ActWin && doc->masterPageMode())
-				swin->setMasterPagesPaletteShown(true);
-			else
-				swin->setMasterPagesPaletteShown(false);
+			swin = dynamic_cast<ScribusWin *>(windows.at(i)->widget());
+			if (swin)
+			{
+				if (swin==ActWin && doc->masterPageMode())
+					swin->setMasterPagesPaletteShown(true);
+				else
+					swin->setMasterPagesPaletteShown(false);
+			}
 		}
 		//if (doc->masterPageMode())
 		//	ActWin->setMasterPagesPaletteShown(true);




More information about the scribus-commit mailing list