Issue 120828

Summary: All ChartModel/ChartView objects are not released
Product: General Reporter: zhang jianfang <zhangjf>
Component: chartAssignee: zhang jianfang <zhangjf>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3    
Version: 3.3.0 or older (OOo)   
Target Milestone: 4.0.0   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 120975, 120831    
Attachments:
Description Flags
fix code patch none

Description zhang jianfang 2012-09-06 05:49:37 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
Comment 1 zhang jianfang 2012-09-06 05:53:02 UTC
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.
Comment 2 zhang jianfang 2012-09-06 07:23:59 UTC
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.
Comment 3 zhang jianfang 2012-09-11 13:11:43 UTC
Take the defect.
Comment 4 SVN Robot 2012-09-11 13:20:57 UTC
"zhangjf" committed SVN revision 1383401 into trunk:
#i120828#, retore some ChartModel::dispose() code to break cyclic reference F...
Comment 5 zhang jianfang 2012-09-11 13:22:14 UTC
Change to resolved state