[Libreoffice-commits] core.git: 2 commits - sw/source

Michael Stahl mstahl at redhat.com
Tue Jul 14 06:02:51 PDT 2015


 sw/source/core/undo/untbl.cxx |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit e0cf60a4acfcb7788ebd145a1ddb7354b5d7d39a
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 14 14:35:43 2015 +0200

    sw: _SaveTable::CreateNew() fix invalid cast ...
    
    ... of SwTableFormat to SwTableBoxFormat for the temporary SwTableBox.
    
    Change-Id: I74118b1b028bd71561f9afe6acd1cc95991a3761

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 40f9ef9..f1cfb15 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -993,8 +993,9 @@ void _SaveTable::CreateNew( SwTable& rTable, bool bCreateFrms,
         pFormat->SetInCache( false );
     }
 
-    // SwTableBox must have a format
-    SwTableBox aParent( static_cast<SwTableBoxFormat*>(pFormat), rTable.GetTabLines().size(), 0 );
+    // SwTableBox must have a format - the SwTableBox takes ownership of it
+    SwTableBoxFormat *const pNewFormat(pFormat->GetDoc()->MakeTableBoxFormat());
+    SwTableBox aParent(pNewFormat, rTable.GetTabLines().size(), 0);
 
     // fill FrameFormats with defaults (0)
     pFormat = 0;
commit 7132dfe7b5030ef5a27a65e5ceaeca67dac96f13
Author: Michael Stahl <mstahl at redhat.com>
Date:   Tue Jul 14 14:34:55 2015 +0200

    sw: assert _SaveTable::CreateNew() deletes everything in temp box
    
    Change-Id: Ib668bb948a2cd557db7b8804f8a81800048f88bd

diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index c2c34a0..40f9ef9 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1068,6 +1068,7 @@ void _SaveTable::CreateNew( SwTable& rTable, bool bCreateFrms,
     }
 
     aParent.GetTabLines().erase( aParent.GetTabLines().begin(), aParent.GetTabLines().begin() + n );
+    assert(aParent.GetTabLines().empty());
 
     if( bCreateFrms )
         aTmpBox.MakeFrms( rTable );


More information about the Libreoffice-commits mailing list