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 15DD6DD9C for ; Thu, 6 Sep 2012 11:57:03 +0000 (UTC) Received: (qmail 4820 invoked by uid 500); 6 Sep 2012 11:57:02 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 4652 invoked by uid 500); 6 Sep 2012 11:56:59 -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 4639 invoked by uid 99); 6 Sep 2012 11:56:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Sep 2012 11:56:59 +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; Thu, 06 Sep 2012 11:56:58 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 59A9123889C5; Thu, 6 Sep 2012 11:56:15 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1381567 - in /incubator/ooo/trunk/main/sw/source/core: docnode/ndsect.cxx unocore/unosect.cxx Date: Thu, 06 Sep 2012 11:56:15 -0000 To: ooo-commits@incubator.apache.org From: hdu@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120906115615.59A9123889C5@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: hdu Date: Thu Sep 6 11:56:14 2012 New Revision: 1381567 URL: http://svn.apache.org/viewvc?rev=1381567&view=rev Log: #i119714# prevent crash in SwXTextSection::attach() As SwDoc::InsertSwSection() can and does return a NULL SwSection pointer callees must be protected. Found-By: Du Jing Modified: incubator/ooo/trunk/main/sw/source/core/docnode/ndsect.cxx incubator/ooo/trunk/main/sw/source/core/unocore/unosect.cxx Modified: incubator/ooo/trunk/main/sw/source/core/docnode/ndsect.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/docnode/ndsect.cxx?rev=1381567&r1=1381566&r2=1381567&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/core/docnode/ndsect.cxx (original) +++ incubator/ooo/trunk/main/sw/source/core/docnode/ndsect.cxx Thu Sep 6 11:56:14 2012 @@ -448,8 +448,7 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( } else if( !pSectNd && pEndSectNd ) { - // versuche eine umschliessende Section zu erzeugen - // Aber, nur wenn das Ende am Section Ende liegt! + // try to create a section enclosing it if the end is at the section end nRet = 0; if( pEnd->nContent.GetIndex() == pCNd->Len() ) { @@ -475,8 +474,7 @@ sal_uInt16 SwDoc::IsInsRegionAvailable( } else if( pSectNd && !pEndSectNd ) { - // versuche eine umschliessende Section zu erzeugen - // Aber, nur wenn der Start am Section Anfang liegt! + // try to create a section enclosing it if the start is at the section start nRet = 0; if( !pStt->nContent.GetIndex() ) { Modified: incubator/ooo/trunk/main/sw/source/core/unocore/unosect.cxx URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/sw/source/core/unocore/unosect.cxx?rev=1381567&r1=1381566&r2=1381567&view=diff ============================================================================== --- incubator/ooo/trunk/main/sw/source/core/unocore/unosect.cxx (original) +++ incubator/ooo/trunk/main/sw/source/core/unocore/unosect.cxx Thu Sep 6 11:56:14 2012 @@ -430,29 +430,28 @@ throw (lang::IllegalArgumentException, u SwSection *const pRet = pDoc->InsertSwSection( aPam, aSect, 0, aSet.Count() ? &aSet : 0 ); - pRet->GetFmt()->Add(m_pImpl.get()); - pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this)); - - // #97450# XML import must hide sections depending on their old - // condition status - if (m_pImpl->m_pProps->m_sCondition.getLength() != 0) + if( pRet ) { - pRet->SetCondHidden(m_pImpl->m_pProps->m_bCondHidden); - } + pRet->GetFmt()->Add(m_pImpl.get()); + pRet->GetFmt()->SetXObject(static_cast< ::cppu::OWeakObject*>(this)); - // set update type if DDE link (and connect, if necessary) - if (m_pImpl->m_pProps->m_bDDE) - { - if (! pRet->IsConnected()) + // XML import must hide sections depending on their old condition status + if (m_pImpl->m_pProps->m_sCondition.getLength() != 0) + pRet->SetCondHidden(m_pImpl->m_pProps->m_bCondHidden); + + // set update type if DDE link (and connect, if necessary) + if (m_pImpl->m_pProps->m_bDDE) { - pRet->CreateLink(CREATE_CONNECT); + if (! pRet->IsConnected()) + pRet->CreateLink(CREATE_CONNECT); + + pRet->SetUpdateType( static_cast< sal_uInt16 >( + (m_pImpl->m_pProps->m_bUpdateType) ? + sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) ); } - pRet->SetUpdateType( static_cast< sal_uInt16 >( - (m_pImpl->m_pProps->m_bUpdateType) ? - sfx2::LINKUPDATE_ALWAYS : sfx2::LINKUPDATE_ONCALL) ); } - // Undo-Klammerung hier beenden + // end section undo here pDoc->GetIDocumentUndoRedo().EndUndo( UNDO_INSSECTION, NULL ); m_pImpl->m_pProps.reset(); m_pImpl->m_bIsDescriptor = false;