From 2ac3f7174bdff8155560fd9fb4a2f82c4184777e Mon Sep 17 00:00:00 2001 From: Arin Alexander Date: Tue, 4 Feb 2020 11:40:05 +0300 Subject: [PATCH] Memory leak has been fixed --- common.pri | 2 +- limereport/lrreportengine.cpp | 15 ++++++++------- limereport/lrreportengine_p.h | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/common.pri b/common.pri index c1f54da..609d3fa 100644 --- a/common.pri +++ b/common.pri @@ -127,7 +127,7 @@ RCC_DIR = $${ARCH_DIR}/$${BUILD_TYPE}/rcc LIMEREPORT_VERSION_MAJOR = 1 LIMEREPORT_VERSION_MINOR = 5 -LIMEREPORT_VERSION_RELEASE = 32 +LIMEREPORT_VERSION_RELEASE = 33 LIMEREPORT_VERSION = '$${LIMEREPORT_VERSION_MAJOR}.$${LIMEREPORT_VERSION_MINOR}.$${LIMEREPORT_VERSION_RELEASE}' DEFINES *= LIMEREPORT_VERSION_STR=\\\"$${LIMEREPORT_VERSION}\\\" diff --git a/limereport/lrreportengine.cpp b/limereport/lrreportengine.cpp index 7da7d87..5f8f7e1 100644 --- a/limereport/lrreportengine.cpp +++ b/limereport/lrreportengine.cpp @@ -1254,6 +1254,11 @@ BaseDesignIntf* ReportEnginePrivate::createWatermark(PageDesignIntf* page, Water } +void ReportEnginePrivate::clearRenderingPages(){ + qDeleteAll(m_renderingPages.begin(), m_renderingPages.end()); + m_renderingPages.clear(); +} + ReportPages ReportEnginePrivate::renderToPages() { int startTOCPage = -1; @@ -1275,7 +1280,7 @@ ReportPages ReportEnginePrivate::renderToPages() m_reportRendering = true; m_reportRender->setDatasources(dataManager()); m_reportRender->setScriptContext(scriptContext()); - m_renderingPages.clear(); + clearRenderingPages(); foreach (PageDesignIntf* page, m_pages) { QVector watermarks; @@ -1349,14 +1354,10 @@ ReportPages ReportEnginePrivate::renderToPages() emit renderFinished(); m_reportRender.clear(); - - //foreach(PageItemDesignIntf* page, m_renderingPages){ - // delete page; - //} - m_renderingPages.clear(); + clearRenderingPages(); } m_reportRendering = false; - //activateLanguage(QLocale::AnyLanguage); + #ifdef USE_QTSCRIPTENGINE ScriptEngineManager::instance().scriptEngine()->popContext(); #endif diff --git a/limereport/lrreportengine_p.h b/limereport/lrreportengine_p.h index efb2881..d49743e 100644 --- a/limereport/lrreportengine_p.h +++ b/limereport/lrreportengine_p.h @@ -311,6 +311,7 @@ private: void initReport(); void paintByExternalPainter(const QString& objectName, QPainter* painter, const QStyleOptionGraphicsItem* options); void dropChanges(){ m_datasources->dropChanges(); m_scriptEngineContext->dropChanges();} + void clearRenderingPages(); private: QList m_pages; QList m_renderingPages;