r22100 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Wed Jul 5 21:30:20 UTC 2017


Author: jghali
Date: Wed Jul  5 21:30:20 2017
New Revision: 22100

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22100
Log:
modify PrefsManager::applyLoadedShortCuts() so as to avoid potential insertion of null action into shortcut list

Modified:
    trunk/Scribus/scribus/prefsmanager.cpp

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22100&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Wed Jul  5 21:30:20 2017
@@ -527,16 +527,17 @@
 
 void PrefsManager::applyLoadedShortCuts()
 {
+	QMap<QString, QPointer<ScrAction> > &actions = ScCore->primaryMainWindow()->scrActions;
+
 	for (QMap<QString,Keys>::Iterator it = appPrefs.keyShortcutPrefs.KeyActions.begin(); it != appPrefs.keyShortcutPrefs.KeyActions.end(); ++it )
 	{
-		if (!it.value().actionName.isEmpty())
-		{
-			if (ScCore->primaryMainWindow()->scrActions[it.value().actionName])
-			{
-				ScCore->primaryMainWindow()->scrActions[it.value().actionName]->setShortcut(it.value().keySequence);
-				ScCore->primaryMainWindow()->scrActions[it.value().actionName]->setToolTipFromTextAndShortcut();
-			}
-		}
+		if (it.value().actionName.isEmpty())
+			continue;
+		QPointer<ScrAction> action = actions.value(it.value().actionName, QPointer<ScrAction>());
+		if (action.isNull())
+			continue;
+		action->setShortcut(it.value().keySequence);
+		action->setToolTipFromTextAndShortcut();
 	}
 }
 




More information about the scribus-commit mailing list