Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id AFC22D21A for ; Fri, 14 Sep 2012 13:27:17 +0000 (UTC) Received: (qmail 73598 invoked by uid 500); 14 Sep 2012 13:27:17 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 73534 invoked by uid 500); 14 Sep 2012 13:27:17 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 73522 invoked by uid 99); 14 Sep 2012 13:27:16 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2012 13:27:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Sep 2012 13:27:14 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id D0EC52388900; Fri, 14 Sep 2012 13:26:29 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1384759 - in /incubator/ooo/trunk/main/sw: inc/doc.hxx source/core/doc/docnew.cxx source/core/doc/docxforms.cxx Date: Fri, 14 Sep 2012 13:26:29 -0000 To: ooo-commits@incubator.apache.org From: zhangjf@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120914132629.D0EC52388900@eris.apache.org> Author: zhangjf Date: Fri Sep 14 13:26:29 2012 New Revision: 1384759 URL: http://svn.apache.org/viewvc?rev=1384759&view=rev Log: #i113606#, in SwDoc dtor to release the cyclic reference between XFormModel and bindings/submissions Patch by: zhangjf Review by: zhangjf Modified: incubator/ooo/trunk/main/sw/inc/doc.hxx incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx incubator/ooo/trunk/main/sw/source/core/doc/docxforms.cxx Modified: incubator/ooo/trunk/main/sw/inc/doc.hxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/inc/doc.hxx?rev=1384759&r1=1384758&r2=1384759&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/inc/doc.hxx (original) +++ incubator/ooo/trunk/main/sw/inc/doc.hxx Fri Sep 14 13:26:29 2012 @@ -2082,6 +2082,8 @@ public: void initXForms( bool bCreateDefaultModel ); // <-- #i31958# access methods for XForms model(s) + void disposeXForms( ); // #i113606#, for disposing XForms + // --> OD 2006-03-21 #b6375613# inline bool ApplyWorkaroundForB6375613() const { Modified: incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx?rev=1384759&r1=1384758&r2=1384759&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx (original) +++ incubator/ooo/trunk/main/sw/source/core/doc/docnew.cxx Fri Sep 14 13:26:29 2012 @@ -683,6 +683,8 @@ SwDoc::~SwDoc() maListStyleLists.clear(); // <-- + disposeXForms(); // #i113606#, dispose the XForms objects + delete pPrtData; delete pNumberFormatter; delete pFtnInfo; Modified: incubator/ooo/trunk/main/sw/source/core/doc/docxforms.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/doc/docxforms.cxx?rev=1384759&r1=1384758&r2=1384759&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/core/doc/docxforms.cxx (original) +++ incubator/ooo/trunk/main/sw/source/core/doc/docxforms.cxx Fri Sep 14 13:26:29 2012 @@ -37,7 +37,7 @@ #include #include #include - +#include using namespace ::com::sun::star; @@ -51,7 +51,7 @@ using xforms::XModel; using frame::XModule; using xforms::XFormsUIHelper1; using rtl::OUString; - +using com::sun::star::container::XIndexAccess; Reference SwDoc::getXForms() const { @@ -117,3 +117,52 @@ void SwDoc::initXForms( bool bCreateDefa DBG_UNHANDLED_EXCEPTION(); } } + +// +// #i113606#, to release the cyclic reference between XFormModel and bindings/submissions. +// +void SwDoc::disposeXForms( ) +{ + // get XForms models + if( xXForms.is() ) + { + // iterate over all models + uno::Sequence aNames = xXForms->getElementNames(); + const OUString* pNames = aNames.getConstArray(); + sal_Int32 nNames = aNames.getLength(); + for( sal_Int32 n = 0; (n < nNames); n++ ) + { + Reference< xforms::XModel > xModel( + xXForms->getByName( pNames[n] ), UNO_QUERY ); + + if( xModel.is() ) + { + // ask model for bindings + Reference< XIndexAccess > xBindings( + xModel->getBindings(), UNO_QUERY ); + + // + // Then release them one by one + // + int nCount = xBindings->getCount(); + for( int i = nCount-1; i >= 0; i-- ) + { + xModel->getBindings()->remove(xBindings->getByIndex( i )); + } + + // ask model for Submissions + Reference< XIndexAccess > xSubmissions( + xModel->getSubmissions(), UNO_QUERY ); + + // + // Then release them one by one + // + nCount = xSubmissions->getCount(); + for( int i = nCount-1; i >= 0; i-- ) + { + xModel->getSubmissions()->remove(xSubmissions->getByIndex( i )); + } + } + } + } +}