Issue 120746 - The FormScriptingEnvironment object created in the FmXUndoEnvironment ctor is never released
Summary: The FormScriptingEnvironment object created in the FmXUndoEnvironment ctor is...
Status: CLOSED FIXED
Alias: None
Product: performance
Classification: Code
Component: code (show other issues)
Version: AOO 3.4.0
Hardware: All All
: P3 Normal (vote)
Target Milestone: not determined
Assignee: zhang jianfang
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 120975
  Show dependency tree
 
Reported: 2012-08-29 06:38 UTC by zhang jianfang
Modified: 2016-04-09 10:38 UTC (History)
0 users

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


Attachments
fix code patch (466 bytes, patch)
2012-08-29 06:46 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-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