[qet] [3061] Bug fix, segfault when print with a folio list.

[ Thread Index | Date Index | More lists.tuxfamily.org/qet Archives ]


Revision: 3061
Author:   blacksun
Date:     2014-05-10 18:00:23 +0200 (Sat, 10 May 2014)
Log Message:
-----------
Bug fix, segfault when print with a folio list.
Fix memory leak too

Modified Paths:
--------------
    trunk/sources/diagramfoliolist.cpp

Modified: trunk/sources/diagramfoliolist.cpp
===================================================================
--- trunk/sources/diagramfoliolist.cpp	2014-05-07 20:56:51 UTC (rev 3060)
+++ trunk/sources/diagramfoliolist.cpp	2014-05-10 16:00:23 UTC (rev 3061)
@@ -35,10 +35,6 @@
 	else
 		id = 0;
 
-	clear();
-	list_lines_.clear();
-	list_rectangles_.clear();
-
 	qreal width  = border_and_titleblock.columnsTotalWidth();
 	qreal height = border_and_titleblock.rowsTotalHeight();
 
@@ -57,6 +53,8 @@
  */
 DiagramFolioList::~DiagramFolioList()
 {
+	qDeleteAll (list_lines_);
+	qDeleteAll (list_rectangles_);
 	int folioSheetQty = project() -> getFolioSheetsQuantity();
 	if (folioSheetQty > 0)
 		project() -> setFolioSheetsQuantity(folioSheetQty-1);
@@ -94,8 +92,13 @@
 	// If the sheet size has changed since last paint, then clear the scene and re-draw the grid.
 	if (sheetRectangle != row_RectBorder) {
 		sheetRectangle = row_RectBorder;
-		clear();
+		foreach(QGraphicsItem *qgi, items()) {
+			removeItem(qgi);
+			qgiManager().release(qgi);
+		}
+		qDeleteAll (list_lines_);
 		list_lines_.clear();
+		qDeleteAll (list_rectangles_);
 		list_rectangles_.clear();
 		buildGrid(row_RectBorder,30,2,colWidths);
 	}


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/