Issue 120746

Summary: The FormScriptingEnvironment object created in the FmXUndoEnvironment ctor is never released
Product: performance Reporter: zhang jianfang <zhangjf>
Component: codeAssignee: zhang jianfang <zhangjf>
Status: CLOSED FIXED QA Contact:
Severity: Normal    
Priority: P3    
Version: AOO 3.4.0   
Target Milestone: not determined   
Hardware: All   
OS: All   
Issue Type: DEFECT Latest Confirmation in: ---
Developer Difficulty: ---
Issue Depends on:    
Issue Blocks: 120975    
Attachments:
Description Flags
fix code patch none

Description zhang jianfang 2012-08-29 06:38:30 UTC
In FmXUndoEnvironment ctor, it calls 
  m_pScriptingEnv( ::svxform::createDefaultFormScriptingEnvironment( _rModel ) )
creates a FormScriptingEnvironment object.

And in svxform::FormScriptingEnvironment ctor api, it creates ListenerImplementation object,
  FormScriptingEnvironment::FormScriptingEnvironment( FmFormModel& _rModel )
        :m_refCount( 0 )
        ,m_pScriptListener( NULL )
        ,m_rFormModel( _rModel )
        ,m_bDisposed( false )
    {
        m_pScriptListener = ListenerImplementation( new FormScriptListener( this ) );
        // note that this is a cyclic reference between the FormScriptListener and the FormScriptingEnvironment
        // This cycle is broken up when our instance is disposed.
    }

So there is cyclic reference between FormScriptingEnvironment and ListenerImplementation object. It needs call to it's FormScriptingEnvironment::dispose() api to break the cyclic reference before it can be released.

But before FmXUndoEnvironment::~FmXUndoEnvironment() is called, FmXUndoEnvironment::dispose() is not never called, so the svxform::FormScriptingEnvironment object get leaked.
Comment 1 zhang jianfang 2012-08-29 06:46:24 UTC
Created attachment 79208 [details]
fix code patch

Because FmXUndoEnvironment::dispose() is not a public API and it does call to FmXUndoEnvironment::dispose(). we can not depend on it. The proposed fix is just to call FmXUndoEnvironment::dispose() in FmXUndoEnvironment dtor api.
Comment 2 SVN Robot 2012-09-05 04:44:34 UTC
"zhangjf" committed SVN revision 1380986 into trunk:
#i120746#, the FormScriptingEnvironment object created in the FmXUndoEnvironm...
Comment 3 zhang jianfang 2012-09-05 04:45:40 UTC
Change to resolved state
Comment 4 Marcus 2016-04-09 10:38:54 UTC
fixed in 4.0.0