[PATCH 1/2] fdo#40701: DbGridControl::RemoveColumn on handle column

Lionel Elie Mamane lionel at mamane.lu
Sun Sep 11 15:00:33 PDT 2011


The handle column (nId == 0) is not a Model column (not in
m_aColumns), but it should still be deleted from base class
(from the view columns).
---
 svx/source/fmcomp/gridctrl.cxx |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index bb666bc..c425029 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1723,11 +1723,13 @@ sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth
 void DbGridControl::RemoveColumn(sal_uInt16 nId)
 {
     sal_uInt16 nIndex = GetModelColumnPos(nId);
+
+    if (nIndex != GRID_COLUMN_NOT_FOUND || nId == 0)
+        DbGridControl_Base::RemoveColumn(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 );
-- 
1.7.2.5


--x+6KMIRAuhnl3hBn
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-FmXGridPeer-getByIndex-Error-checking-of-pGrid-GetMo.patch"



More information about the LibreOffice mailing list