r15190 by jghali - barcode plugin : fix memory leak + undo transaction being potentially never canceled or committed

scribus-commit scribus-commit at lists.scribus.net
Tue Jun 15 22:50:23 CEST 2010


Revision: 15190
Author: jghali
Date: 2010-06-15T20:47:15.624483Z
Commit message: barcode plugin : fix memory leak + undo transaction being potentially never canceled or committed

Changeset: 
M  /branches/Version135/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp

Diffs:
Index: scribus/plugins/barcodegenerator/barcodegenerator.cpp
===================================================================
--- scribus/plugins/barcodegenerator/barcodegenerator.cpp	(revision 15189)
+++ scribus/plugins/barcodegenerator/barcodegenerator.cpp	(revision 15190)
@@ -16,9 +16,9 @@
 #include "util_ghostscript.h"
 #include "util_icon.h"
 
-
+#include <QSharedPointer>
+#include <QColorDialog>
 #include <QTextStream>
-#include <QColorDialog>
 
 BarcodeType::BarcodeType(QString cmd, QString exa,
 						 QString comm, QString regExp,
@@ -235,17 +235,18 @@
 	hide();
 	const FileFormat * fmt = LoadSavePlugin::getFormatById(FORMATID_PSIMPORT);
 
-	UndoTransaction * tran = 0;
+	QSharedPointer<UndoTransaction> tran;
 	if (UndoManager::undoEnabled())
 	{
-		tran = new UndoTransaction(
+		tran = QSharedPointer<UndoTransaction>( new UndoTransaction(
 				UndoManager::instance()->beginTransaction(
 							ScCore->primaryMainWindow()->doc->currentPage()->getUName(),
 							Um::IImageFrame,
 							Um::ImportBarcode,
 							ui.bcCombo->currentText() + " (" + ui.codeEdit->text() + ")",
 							Um::IEPS)
-						);
+						)
+				);
 	}
 
 	if (fmt)




More information about the scribus-commit mailing list