Apache OpenOffice (AOO) Bugzilla – Issue 120828
All ChartModel/ChartView objects are not released
Last modified: 2013-07-12 12:22:43 UTC
You can recreate the problem by simply opening a document with a chart inside then close the document, from the code, you can observe that ChartModel dtor api are never called. It is a regression problem since hg changeset 274456, undoapi: step 0.1 of the migration of css.chart2.XUndoManager to css.document.XUndoManager: remove the XModel paramter from the XUndoManager methods, they're an implicit attribute of the instance author Frank Schoenheit [fs] <frank.schoenheit@oracle.com> Tue Nov 09 21:36:54 2010 +0100 (22 months ago) changeset 274456 87f2fab49f69 parent 274455 3bf4889782b9 child 274457 491247d7bc5c undoapi: step 0.1 of the migration of css.chart2.XUndoManager to css.document.XUndoManager: remove the XModel paramter from the XUndoManager methods, they're an implicit attribute of the instance
The root cause is in ChartModel ctor, it calls, m_xOldModelAgg.set( m_xContext->getServiceManager()->createInstanceWithContext( CHART_CHARTAPIWRAPPER_SERVICE_NAME, m_xContext ), uno::UNO_QUERY_THROW ); m_xOldModelAgg->setDelegator( *this ); Then xOldModelAgg has a cycle reference back to ChartModel object itself. While in hg changeset 274456, it removes below code from ChartModel::Dispose() if( m_xOldModelAgg.is()) { m_xOldModelAgg->setDelegator( 0 ); m_xOldModelAgg.clear(); } So it never has a chance to reset the cyclic reference.
Created attachment 79311 [details] fix code patch So the simple fix is to take back the code to break the cyclic reference. Please anyone who is familiar with this part of historic code help to review the patch. Thanks.
Take the defect.
"zhangjf" committed SVN revision 1383401 into trunk: #i120828#, retore some ChartModel::dispose() code to break cyclic reference F...
Change to resolved state