Issue 120828 - All ChartModel/ChartView objects are not released
All ChartModel/ChartView objects are not released
Status: CLOSED FIXED
Product: General
Classification: Code
Component: chart
OOo 3.3 or older
All All
: P3 normal (vote)
: 4.0.0
Assigned To: zhang jianfang
:
Depends on:
Blocks: 120975 120831
  Show dependency treegraph
 
Reported: 2012-09-06 05:49 UTC by zhang jianfang
Modified: 2013-07-12 12:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Latest Confirmation on: ---
Developer Difficulty: ---


Attachments
fix code patch (598 bytes, patch)
2012-09-06 07:23 UTC, zhang jianfang
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
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