From dde2d3716fd9522fe1473076c7a7955577205a1f Mon Sep 17 00:00:00 2001 From: blacksun Date: Sat, 10 May 2014 16:00:23 +0000 Subject: [PATCH] Bug fix, segfault when print with a folio list. Fix memory leak too git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@3061 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/diagramfoliolist.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sources/diagramfoliolist.cpp b/sources/diagramfoliolist.cpp index 8e45ee5ff..ce0afe726 100644 --- a/sources/diagramfoliolist.cpp +++ b/sources/diagramfoliolist.cpp @@ -35,10 +35,6 @@ DiagramFolioList::DiagramFolioList( QETProject *project, QObject *parent) : Diag 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( QETProject *project, QObject *parent) : Diag */ DiagramFolioList::~DiagramFolioList() { + qDeleteAll (list_lines_); + qDeleteAll (list_rectangles_); int folioSheetQty = project() -> getFolioSheetsQuantity(); if (folioSheetQty > 0) project() -> setFolioSheetsQuantity(folioSheetQty-1); @@ -94,8 +92,13 @@ void DiagramFolioList::drawBackground(QPainter *p, const QRectF &r) // 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); }