Hi all,

According to C++ standard, deleting a null pointer has no effect.
This patch removes checks for NULL before using delete.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
Index: bindings/qt_gui/plqt.cpp
===================================================================
--- bindings/qt_gui/plqt.cpp	(revision 10115)
+++ bindings/qt_gui/plqt.cpp	(working copy)
@@ -381,7 +381,7 @@
 
 QtRasterDevice::~QtRasterDevice()
 {
-	if(m_painterP!=NULL) delete m_painterP;
+	delete m_painterP;
 }
 
 void QtRasterDevice::definePlotName(const char* fileName, const char* format)
@@ -418,7 +418,7 @@
 
 QtSVGDevice::~QtSVGDevice()
 {
-	if(m_painterP!=NULL) delete m_painterP;
+	delete m_painterP;
 }
 
 void QtSVGDevice::definePlotName(const char* fileName)
@@ -471,7 +471,7 @@
 
 QtEPSDevice::~QtEPSDevice()
 {
-	if(m_painterP!=NULL) delete m_painterP;
+	delete m_painterP;
 }
 
 void QtEPSDevice::definePlotName(const char* fileName, int ifeps)
@@ -513,7 +513,7 @@
 QtPLWidget::~QtPLWidget()
 {
 	clearBuffer();
-	if(m_pixPixmap!=NULL) delete m_pixPixmap;
+	delete m_pixPixmap;
 }
 
 void QtPLWidget::clearWidget()
@@ -751,11 +751,8 @@
 void QtPLWidget::resizeEvent( QResizeEvent * )
 {
 	m_bAwaitingRedraw=true;
-	if(m_pixPixmap!=NULL)
-	{
-		delete m_pixPixmap;
-		m_pixPixmap=NULL;
-	}
+	delete m_pixPixmap;
+	m_pixPixmap=NULL;
 }
 
 void QtPLWidget::paintEvent( QPaintEvent * )
@@ -765,7 +762,7 @@
 	getPlotParameters(x_fact, y_fact, x_offset, y_offset);
 	if(m_bAwaitingRedraw || m_pixPixmap==NULL || m_listBuffer.size()!=m_iOldSize) // If must regenerate image, draw it in the pixmap
 	{
-		if(m_pixPixmap!=NULL) delete m_pixPixmap;
+		delete m_pixPixmap;
 		m_pixPixmap=new QPixmap(width(), height());
 		QPainter* painter=new QPainter;
 		painter->begin(m_pixPixmap);
@@ -906,12 +903,10 @@
 {
 	killed=true;
 	QCoreApplication::processEvents(QEventLoop::AllEvents, 10);
-	if(m_pixPixmap!=NULL) delete m_pixPixmap;
-	if(m_painterP!=NULL) delete m_painterP;
-// 	if(pic!=NULL) delete pic;
+	delete m_pixPixmap;
+	delete m_painterP;
 	m_pixPixmap=NULL;
 	m_painterP=NULL;
-// 	pic=NULL;
 }
 
 void QtExtWidget::captureMousePlotCoords(PLFLT* x, PLFLT* y)
------------------------------------------------------------------------------
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to