r15318 by jghali - #9250 : undoing "Paste" from another doc crashes Scribus

scribus-commit scribus-commit at lists.scribus.net
Sun Jul 11 15:20:46 CEST 2010


Revision: 15318
Author: jghali
Date: 2010-07-11T13:15:10.361057Z
Commit message: #9250 : undoing "Paste" from another doc crashes Scribus

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

Diffs:
Index: scribus/selection.cpp
===================================================================
--- scribus/selection.cpp	(revision 15317)
+++ scribus/selection.cpp	(revision 15318)
@@ -567,7 +567,10 @@
 	if (m_isGUISelection && (m_delaySignals <= 0))
 	{
 		setGroupRect();
-		if (guiConnect)
+		// JG - We should probably add an m_sigSelectionChanged here
+		// to avoid multiple connectItemToGUI() if sendSignals() is called 
+		// several times successively (but does that happen?)
+		if (guiConnect /*&& m_sigSelectionChanged*/)
 			connectItemToGUI();
 		if (m_sigSelectionChanged)
 			emit selectionChanged();
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 15317)
+++ scribus/scribus.cpp	(revision 15318)
@@ -1916,12 +1916,11 @@
 	if (requiresGUI)
 	{
 		w->setSubWin(mdiArea->addSubWindow(w));
-		connect(undoManager, SIGNAL(undoRedoBegin()), tempDoc, SLOT(undoRedoBegin()));
-		connect(undoManager, SIGNAL(undoRedoDone()), tempDoc, SLOT(undoRedoDone()));
-		connect(undoManager, SIGNAL(undoRedoDone()), tempView, SLOT(DrawNew()));
-		//connect(w, SIGNAL(Schliessen()), this, SLOT(DoFileClose()));
+		//#9250 : transfered to newActWin()
+		//connect(undoManager, SIGNAL(undoRedoBegin()), tempDoc, SLOT(undoRedoBegin()));
+		//connect(undoManager, SIGNAL(undoRedoDone()), tempDoc, SLOT(undoRedoDone()));
+		//connect(undoManager, SIGNAL(undoRedoDone()), tempView, SLOT(DrawNew()));
 		connect(tempView, SIGNAL(signalGuideInformation(int, qreal)), alignDistributePalette, SLOT(setGuide(int, qreal)));
-		//	connect(w, SIGNAL(SaveAndClose()), this, SLOT(DoSaveClose()));
 	}
 	//Independent finishing tasks after tempDoc setup
 	if (showView)
@@ -1984,7 +1983,6 @@
 	alignDistributePalette->setDoc(doc);
 	connect(undoManager, SIGNAL(undoRedoDone()), view, SLOT(DrawNew()));
 	view->show();
-	//connect(w, SIGNAL(Schliessen()), this, SLOT(DoFileClose()));
 }
 
 void ScribusMainWindow::windowsMenuAboutToShow()
@@ -2071,9 +2069,23 @@
 	}
 	docCheckerPalette->clearErrorList();
 
+	if (HaveDoc && (doc != NULL) && doc->hasGUI())
+	{
+		disconnect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin()));
+		disconnect(undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone()));
+		disconnect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew()));
+	}
+
 	doc = ActWin->doc();
 	undoManager->switchStack(doc->DocName);
 
+	if ((doc != NULL) && doc->hasGUI())
+	{
+		connect(undoManager, SIGNAL(undoRedoBegin()), doc, SLOT(undoRedoBegin()));
+		connect(undoManager, SIGNAL(undoRedoDone()) , doc, SLOT(undoRedoDone()));
+		connect(undoManager, SIGNAL(undoRedoDone()) , doc->view(), SLOT(DrawNew()));
+	}
+
 	if (view!=NULL)
 	{
 		actionManager->disconnectNewViewActions();
@@ -3702,7 +3714,6 @@
 			doc->pdfOptions().LPISettings.insert("Black", lpo);
 		}
 
-		//connect(w, SIGNAL(Schliessen()), this, SLOT(DoFileClose()));
 		if (!doc->cmsSettings().CMSinUse)
 			doc->HasCMS = false;
 		if ((ScCore->haveCMS()) && (doc->cmsSettings().CMSinUse))
@@ -9162,7 +9173,6 @@
 			{
 				std::cout << "Saving: " << doc->DocName.toStdString() << ".emergency" << std::endl;
 				doc->autoSaveTimer->stop();
-				//disconnect(ActWin, SIGNAL(Schliessen()), ScMW, SLOT(DoFileClose()));
 				FileLoader fl(doc->DocName+".emergency");
 				fl.SaveFile(doc->DocName+".emergency", doc, 0);
 			}




More information about the scribus-commit mailing list