r13909 by jghali - #8381: Scribus crashes when window is closed while still rendering preview mode

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 26 05:55:45 CEST 2009


Revision: 13909
Author: jghali
Date: 2009-08-24T18:46:28.488666Z
Commit message: #8381: Scribus crashes when window is closed while still rendering preview mode 

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

Diffs:
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 13908)
+++ scribus/scribusdoc.cpp	(revision 13909)
@@ -6649,6 +6649,7 @@
 {
 	int cc = 0;
 	int ca = 0;
+	ScGuardedPtr<ScribusDoc> docPtr = guardedPtr();
 	m_ScMW->mainWindowProgressBar->reset();
 	for (int a = 0; a < DocItems.count(); ++a)
 	{
@@ -6696,6 +6697,7 @@
 			ca++;
 			m_ScMW->mainWindowProgressBar->setValue(ca);
 			qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+			if (!docPtr) return;
 		}
 	}
 	for (int a = 0; a < MasterItems.count(); ++a)
@@ -6714,6 +6716,7 @@
 			ca++;
 			m_ScMW->mainWindowProgressBar->setValue(ca);
 			qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+			if (!docPtr) return;
 		}
 	}
 	for (int a = 0; a < FrameItems.count(); ++a)
@@ -6732,6 +6735,7 @@
 			ca++;
 			m_ScMW->mainWindowProgressBar->setValue(ca);
 			qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+			if (!docPtr) return;
 		}
 	}
 	for (int c = 0; c < patterns.count(); ++c)
@@ -6753,6 +6757,7 @@
 				ca++;
 				m_ScMW->mainWindowProgressBar->setValue(ca);
 				qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
+				if (!docPtr) return;
 			}
 		}
 		PageItem *ite = pa.items.at(0);
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(revision 13908)
+++ scribus/scribusview.cpp	(revision 13909)
@@ -457,10 +457,14 @@
 	previewToolbarButton->setChecked(m_canvas->m_viewMode.viewAsPreview);
 #endif
 	visualMenu->setEnabled(m_canvas->m_viewMode.viewAsPreview);
+	ScGuardedPtr<ScribusDoc> docPtr = Doc->guardedPtr();
 	Doc->recalculateColors();
 	Doc->recalcPicturesRes();
 //	repaintContents(QRect());
-	DrawNew();
+	if (docPtr) // document may have been destroyed in-between
+	{
+		DrawNew();
+	}
 }
 
 void ScribusView::changed(QRectF re)




More information about the scribus-commit mailing list