Author: hdu
Date: Mon Jun 25 11:18:26 2012
New Revision: 1353465

URL: http://svn.apache.org/viewvc?rev=1353465&view=rev
Log:
#i120079# fix a memory leak in framework::Frame::initialize()

Patch by: Chao Huang
Found by: Chao Huang
Review by: hdu

Modified:
    incubator/ooo/trunk/main/framework/inc/services/frame.hxx
    incubator/ooo/trunk/main/framework/source/services/frame.cxx

Modified: incubator/ooo/trunk/main/framework/inc/services/frame.hxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/framework/inc/services/frame.hxx?rev=1353465&r1=1353464&r2=1353465&view=diff
==============================================================================
--- incubator/ooo/trunk/main/framework/inc/services/frame.hxx (original)
+++ incubator/ooo/trunk/main/framework/inc/services/frame.hxx Mon Jun 25 
11:18:26 2012
@@ -434,6 +434,7 @@ class Frame :       // interfaces
         css::uno::Reference< ::com::sun::star::frame::XLayoutManager >    
m_xLayoutManager                    ;   /// is used to layout the child windows 
of the frame.
         css::uno::Reference< css::frame::XDispatchInformationProvider >        
 m_xDispatchInfoHelper               ;
         css::uno::Reference< css::frame::XTitle >                              
 m_xTitleHelper                      ;
+            void*                                                              
     mp_WindowCommandDispatch            ;   /// holds the window command 
dispatch
 
     protected:
 

Modified: incubator/ooo/trunk/main/framework/source/services/frame.cxx
URL: 
http://svn.apache.org/viewvc/incubator/ooo/trunk/main/framework/source/services/frame.cxx?rev=1353465&r1=1353464&r2=1353465&view=diff
==============================================================================
--- incubator/ooo/trunk/main/framework/source/services/frame.cxx (original)
+++ incubator/ooo/trunk/main/framework/source/services/frame.cxx Mon Jun 25 
11:18:26 2012
@@ -294,6 +294,7 @@ Frame::Frame( const css::uno::Reference<
         ,   m_bSelfClose                ( sal_False                            
             ) // Important!
         ,   m_bIsHidden                 ( sal_True                             
             )
         ,   m_xTitleHelper              (                                      
             )
+            ,   mp_WindowCommandDispatch    ( NULL                             
                 )
         ,   m_aChildFrameContainer      (                                      
             )
 {
     // Check incoming parameter to avoid against wrong initialization.
@@ -316,6 +317,10 @@ Frame::Frame( const css::uno::Reference<
 Frame::~Frame()
 {
     LOG_ASSERT2( m_aTransactionManager.getWorkingMode()!=E_CLOSE, 
"Frame::~Frame()", "Who forgot to dispose this service?" )
+        if (mp_WindowCommandDispatch != NULL)
+        {
+                 delete ((WindowCommandDispatch *)mp_WindowCommandDispatch);  
// memory leak #i120079#
+        }
 }
 
 
/*-************************************************************************************************************//**
@@ -625,7 +630,7 @@ void SAL_CALL Frame::initialize( const c
     impl_enablePropertySet();
 
     // create WindowCommandDispatch; it is supposed to release itself at frame 
destruction
-    (void)new WindowCommandDispatch(xSMGR, this);
+    mp_WindowCommandDispatch = new WindowCommandDispatch(xSMGR, this);  // 
memory leak #i120079#
 
     // Initialize title functionality
     TitleHelper* pTitleHelper = new TitleHelper(xSMGR);


Reply via email to