r20790 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sat Jan 30 16:46:39 UTC 2016


Author: jghali
Date: Sat Jan 30 16:46:38 2016
New Revision: 20790

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20790
Log:
coverity #1350790, uninitialized pointer field

Modified:
    trunk/Scribus/scribus/scpattern.cpp
    trunk/Scribus/scribus/scpattern.h

Modified: trunk/Scribus/scribus/scpattern.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20790&path=/trunk/Scribus/scribus/scpattern.cpp
==============================================================================
--- trunk/Scribus/scribus/scpattern.cpp	(original)
+++ trunk/Scribus/scribus/scpattern.cpp	Sat Jan 30 16:46:38 2016
@@ -33,6 +33,7 @@
 ScPattern::ScPattern()
 {
 	items.clear();
+	doc = 0;
 	pattern = QImage();
 	scaleX = 1.0;
 	scaleY = 1.0;
@@ -50,9 +51,9 @@
 //	}
 }
 
-void ScPattern::setDoc(ScribusDoc *doc)
+void ScPattern::setDoc(ScribusDoc *theDoc)
 {
-	m_doc = doc;
+	doc = theDoc;
 }
 
 QImage* ScPattern::getPattern()
@@ -63,8 +64,8 @@
 void ScPattern::setPattern(QString name)
 {
 	items.clear();
-	m_doc->setLoading(true);
-	PageItem* newItem = new PageItem_ImageFrame(m_doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
+	doc->setLoading(true);
+	PageItem* newItem = new PageItem_ImageFrame(doc, 0, 0, 1, 1, 0, CommonStrings::None, CommonStrings::None);
 	if (newItem->loadImage(name, false, 72, false))
 	{
 		pattern = newItem->pixm.qImage().copy();
@@ -83,14 +84,14 @@
 	}
 	else
 		pattern = QImage();
-	m_doc->setLoading(false);
+	doc->setLoading(false);
 }
 
 void ScPattern::createPreview()
 {
 	double sc = 500.0 / qMax(width, height);
-	bool savedFlag = m_doc->guidesPrefs().framesShown;
-	m_doc->guidesPrefs().framesShown = false;
+	bool savedFlag = doc->guidesPrefs().framesShown;
+	doc->guidesPrefs().framesShown = false;
 	pattern = QImage(qRound(width * sc), qRound(height * sc), QImage::Format_ARGB32_Premultiplied);
 	pattern.fill( qRgba(0, 0, 0, 0) );
 	ScPainter *painter = new ScPainter(&pattern, pattern.width(), pattern.height(), 1, 0);
@@ -108,5 +109,5 @@
 	}
 	painter->end();
 	delete painter;
-	m_doc->guidesPrefs().framesShown = savedFlag;
+	doc->guidesPrefs().framesShown = savedFlag;
 }

Modified: trunk/Scribus/scribus/scpattern.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20790&path=/trunk/Scribus/scribus/scpattern.h
==============================================================================
--- trunk/Scribus/scribus/scpattern.h	(original)
+++ trunk/Scribus/scribus/scpattern.h	Sat Jan 30 16:46:38 2016
@@ -38,10 +38,12 @@
 public:
 	ScPattern();
 	~ScPattern();
+
 	QImage* getPattern();
-	void setDoc(ScribusDoc *doc);
+	void setDoc(ScribusDoc *theDoc);
 	void setPattern(QString file);
 	void createPreview();
+
 	double scaleX;
 	double scaleY;
 	double height;
@@ -49,7 +51,7 @@
 	double xoffset;
 	double yoffset;
 	QList<PageItem*> items;
-	ScribusDoc *m_doc;
+	ScribusDoc *doc;
 	QImage pattern;
 };
 




More information about the scribus-commit mailing list