r24745 by jghali - Code cleanup (also fix a null pointer dereference discovered by SonarLint)

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 18 22:06:44 UTC 2021


Author: jghali
Date: Mon Oct 18 22:06:44 2021
New Revision: 24745

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24745
Log:
Code cleanup (also fix a null pointer dereference discovered by SonarLint)

Modified:
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24745&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	Mon Oct 18 22:06:44 2021
@@ -15,6 +15,10 @@
 #include "undotransaction.h"
 
 HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, PageItem *item)
+              : QDialog(parent),
+                m_doc(doc),
+                m_item(item),
+                m_iText(&item->itemText)
 {
 	setupUi( this );
 	setModal( true );
@@ -24,14 +28,12 @@
 	connect (changePushButton, SIGNAL(clicked()), this, SLOT(changeWord()));
 	connect (changeAllPushButton, SIGNAL(clicked()), this, SLOT(changeAllWords()));
 	connect (languagesComboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(languageComboChanged(const QString &)));
-
-	m_doc = doc;
-	m_docChanged = false;
-	m_item  = item;
-	m_iText = &m_item->itemText;
-}
-
-HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, StoryText *item)
+}
+
+HunspellDialog::HunspellDialog(QWidget *parent, ScribusDoc *doc, StoryText * itemText)
+              : QDialog(parent),
+                m_doc(doc),
+                m_iText(itemText)
 {
 	setupUi( this );
 	setModal( true );
@@ -41,11 +43,6 @@
 	connect (changePushButton, SIGNAL(clicked()), this, SLOT(changeWord()));
 	connect (changeAllPushButton, SIGNAL(clicked()), this, SLOT(changeAllWords()));
 	connect (languagesComboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(languageComboChanged(const QString &)));
-
-	m_doc = doc;
-	m_docChanged = false;
-	m_item  = nullptr;
-	m_iText = &m_item->itemText;
 }
 
 void HunspellDialog::set(QMap<QString, QString>* dictionaryMap, QMap<QString, HunspellDict*> *hspellerMap, QList<WordsFound> *wfList)

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24745&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.h	Mon Oct 18 22:06:44 2021
@@ -20,7 +20,7 @@
 
 	public:
 		HunspellDialog(QWidget* parent, ScribusDoc *doc, PageItem* item);
-		HunspellDialog(QWidget* parent, ScribusDoc *doc, StoryText* iText);
+		HunspellDialog(QWidget* parent, ScribusDoc *doc, StoryText* itemText);
 		~HunspellDialog() {};
 
 		void set(QMap<QString, QString>* dictionaryMap, QMap<QString, HunspellDict*> *hspellerMap, QList<WordsFound>* wfList);




More information about the scribus-commit mailing list