From a624f7946d07c7dfa2e8b81346f99bc636e59334 Mon Sep 17 00:00:00 2001 From: mkr Date: Wed, 21 Mar 2007 12:44:07 +0000 Subject: [PATCH] QxGraph_Canvas destructor: clear a list of Prs objects. QxGraph_Prs destructor: delete all existing graphic items. --- src/QxGraph/QxGraph_Canvas.cxx | 7 +++++-- src/QxGraph/QxGraph_Prs.cxx | 17 +++++++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/src/QxGraph/QxGraph_Canvas.cxx b/src/QxGraph/QxGraph_Canvas.cxx index a11e53f26..8eb1afe63 100644 --- a/src/QxGraph/QxGraph_Canvas.cxx +++ b/src/QxGraph/QxGraph_Canvas.cxx @@ -48,7 +48,7 @@ QxGraph_Canvas::QxGraph_Canvas(SUIT_ResourceMgr* theMgr) : */ QxGraph_Canvas::~QxGraph_Canvas() { - QObjectList* aNodeList = queryList("QObject"); + /*QObjectList* aNodeList = queryList("QObject"); QObjectListIt aIt(*aNodeList); QObject* anObj; while ( (anObj = aIt.current()) != 0 ) { @@ -56,7 +56,10 @@ QxGraph_Canvas::~QxGraph_Canvas() aNodeList->removeRef(anObj); delete anObj; } - delete aNodeList; + delete aNodeList;*/ + + myPrsList.setAutoDelete(true); + myPrsList.clear(); } /*! diff --git a/src/QxGraph/QxGraph_Prs.cxx b/src/QxGraph/QxGraph_Prs.cxx index ef453e4b0..26ec0e4d9 100644 --- a/src/QxGraph/QxGraph_Prs.cxx +++ b/src/QxGraph/QxGraph_Prs.cxx @@ -43,7 +43,20 @@ QxGraph_Prs::QxGraph_Prs(QxGraph_Canvas* theCanvas): */ QxGraph_Prs::~QxGraph_Prs() { - + for ( DMode2ItemList::iterator it1 = myDisplayMap.begin(); + it1 != myDisplayMap.end(); + it1++ ) + { + for ( std::list::iterator it2 = (*it1).second.begin(); + it2 != (*it1).second.end(); + it2++ ) + { + QCanvasItem* anItem = *it2; + if ( anItem ) delete anItem; + } + } + + myDisplayMap.clear(); } /*! @@ -62,7 +75,7 @@ void QxGraph_Prs::addItem(QCanvasItem* theItem, int theDMode) */ void QxGraph_Prs::show() { - if ( isToUpdate() ) + if ( isToUpdate() ) update(); for ( std::list::iterator it = myDisplayMap[myDMode].begin(); -- 2.39.2