incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
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 GMT
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;



Mime
View raw message