[Libreoffice-commits] .: Branch 'libreoffice-3-4' - 2 commits - svx/source

Petr Mladek pmladek at kemper.freedesktop.org
Mon Oct 24 08:25:47 PDT 2011


 svx/source/fmcomp/fmgridif.cxx |    3 +++
 svx/source/fmcomp/gridctrl.cxx |    4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 8590273b3ee8f34386bcb9e620fab10794b38a6f
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Sun Sep 11 23:40:09 2011 +0200

    FmXGridPeer::getByIndex: Error checking of pGrid->GetModelColumnPos(nId) call
    
    Fixes crash of fdo#40701, but not broken feature
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 3080d77..a4146a9 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -2442,6 +2442,9 @@ Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException,
     // get the list position
     sal_uInt16 nPos = pGrid->GetModelColumnPos(nId);
 
+    if ( nPos == GRID_COLUMN_NOT_FOUND )
+        return aElement;
+
     DbGridColumn* pCol = pGrid->GetColumns().at( nPos );
     Reference< ::com::sun::star::awt::XControl >  xControl(pCol->GetCell());
     aElement <<= xControl;
commit 45e6ceee47e4f1c5fdf800ae35b062f8387cf61c
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Mon Sep 12 00:00:33 2011 +0200

    fdo#40701: DbGridControl::RemoveColumn even if no corresponding Model column
    
    That case crops up when nId==0 i.e. the Handle column
    
    Signed-off-by: Petr Mladek <pmladek at suse.cz>

diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index bb666bc..eaf6a31 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1722,12 +1722,12 @@ sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth
 //------------------------------------------------------------------------------
 void DbGridControl::RemoveColumn(sal_uInt16 nId)
 {
+    DbGridControl_Base::RemoveColumn(nId);
+
     sal_uInt16 nIndex = GetModelColumnPos(nId);
     if (nIndex == GRID_COLUMN_NOT_FOUND)
         return;
 
-    DbGridControl_Base::RemoveColumn(nId);
-
     delete m_aColumns[ nIndex ];
     DbGridColumns::iterator it = m_aColumns.begin();
     ::std::advance( it, nIndex );


More information about the Libreoffice-commits mailing list