r19994 by craig - #13006: Properly delete the allocated obejcts that are not auto deleted

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 11 16:22:06 UTC 2015


Author: craig
Date: Sat Apr 11 16:22:05 2015
New Revision: 19994

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19994
Log:
#13006: Properly delete the allocated obejcts that are not auto deleted

Modified:
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19994&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp Sat Apr 11 16:22:05 2015
@@ -25,7 +25,10 @@
 #include "util_icon.h"
 #include "util_formats.h"
 
-PictureBrowser::PictureBrowser ( ScribusDoc* doc, QWidget *parent ) : QDialog ( parent )
+PictureBrowser::PictureBrowser ( ScribusDoc* doc, QWidget *parent ) :
+	QDialog ( parent ),
+	pImages(0),
+	pModel(0)
 {
 	setupUi ( this );
 
@@ -280,6 +283,14 @@
 
 PictureBrowser::~PictureBrowser()
 {
+}
+
+void PictureBrowser::closeEvent(QCloseEvent* e)
+{
+	delete pImages;
+	pImages=0;
+	delete pModel;
+	pModel=0;
 }
 
 
@@ -1569,7 +1580,8 @@
 
 	if ( sort )
 	{
-		pImages->sortPreviewImages ( pbSettings.sortSetting );
+		if (pImages)
+			pImages->sortPreviewImages ( pbSettings.sortSetting );
 	}
 
 	if ( reload )
@@ -1585,7 +1597,8 @@
 		}
 	}
 
-	pModel->setModelItemsList ( pImages->previewImagesList );
+	if (pModel)
+		pModel->setModelItemsList ( pImages->previewImagesList );
 	statusLabel->setText ( QString ( "%1 image(s) displayed, %2 image(s) filtered" ).arg ( imagesDisplayed ).arg ( imagesFiltered ) );
 }
 

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19994&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.h Sat Apr 11 16:22:05 2015
@@ -7,6 +7,7 @@
 #ifndef PICTUREBROWSER_H
 #define PICTUREBROWSER_H
 
+#include <QCloseEvent>
 #include <QDirModel>
 #include "ui_picturebrowser.h"
 
@@ -100,6 +101,7 @@
 	public:
 		PictureBrowser ( ScribusDoc* doc, QWidget *parent = 0 );
 		~PictureBrowser();
+		void closeEvent(QCloseEvent *e);
 		void changedDocument ( ScribusDoc* doc );
 		void closedDocument();
 




More information about the scribus-commit mailing list