r19203 by jghali - #12359: Renaming items in Scrapbook may crash Scribus

scribus-commit scribus-commit at lists.scribus.net
Mon Jun 9 22:00:14 UTC 2014


Author: jghali
Date: Mon Jun  9 22:00:14 2014
New Revision: 19203

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19203
Log:
#12359: Renaming items in Scrapbook may crash Scribus

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

Modified: trunk/Scribus/scribus/ui/scrapbookpalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19203&path=/trunk/Scribus/scribus/ui/scrapbookpalette.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/scrapbookpalette.cpp (original)
+++ trunk/Scribus/scribus/ui/scrapbookpalette.cpp Mon Jun  9 22:00:14 2014
@@ -1143,6 +1143,9 @@
 
 void Biblio::HandleMouse(QPoint p)
 {
+	// #12359 : stop the file watcher here as it may run and trigger regeneration of
+	// scrapbook content, hence invalidating actItem while context menu is executing.
+	ScCore->fileWatcher->stop();
 	QListWidgetItem *ite = activeBView->itemAt(p);
 	if (ite != 0)
 	{
@@ -1168,20 +1171,16 @@
 		for (int a = 0; a < Frame3->count(); a++)
 		{
 			BibView* bv = (BibView*)Frame3->widget(a);
-			if (bv != activeBView)
-			{
-				if (bv->canWrite)
-				{
-        			QAction *action = pmenu2->addAction(Frame3->itemText(Frame3->indexOf(Frame3->widget(a))));
-					connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
-					signalMapper->setMapping(action, a);
-					if (activeBView->canWrite)
-					{
-        				QAction *action2 = pmenu3->addAction(Frame3->itemText(Frame3->indexOf(Frame3->widget(a))));
-						connect(action2, SIGNAL(triggered()), signalMapper2, SLOT(map()));
-						signalMapper2->setMapping(action2, a);
-					}
-				}
+			if ((bv == activeBView) || (!bv->canWrite))
+				continue;
+			QAction *action = pmenu2->addAction(Frame3->itemText(Frame3->indexOf(Frame3->widget(a))));
+			connect(action, SIGNAL(triggered()), signalMapper, SLOT(map()));
+			signalMapper->setMapping(action, a);
+			if (activeBView->canWrite)
+			{
+				QAction *action2 = pmenu3->addAction(Frame3->itemText(Frame3->indexOf(Frame3->widget(a))));
+				connect(action2, SIGNAL(triggered()), signalMapper2, SLOT(map()));
+				signalMapper2->setMapping(action2, a);
 			}
 		}
 		pmenu->addMenu(pmenu2);
@@ -1212,6 +1211,7 @@
 	}
 	activeBView->clearSelection();
 	actItem = 0;
+	ScCore->fileWatcher->start();
 }
 
 bool Biblio::copyObj(int id)




More information about the scribus-commit mailing list