Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi Lionel,

On Monday, 2011-09-12 00:25:51 +0200, Lionel Elie Mamane wrote:

0001-fdo-40701-DbGridControl-RemoveColumn-even-if-no-corr.patch
fixes the root cause of the bug, which caused
void DbGridControl::EnableHandle(sal_Bool bEnable)
{
    RemoveColumn(0);
    m_bHandle = bEnable;
    InsertHandleColumn();
}
to misfunction: RemoveColumn(0) silently did not remove the column, so
the call to InsertHandleColumn() added a second Handle Column, which
confused the code in other places.

Hmm.. this

@@ -1723,11 +1723,12 @@ 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)
-        return;
 
     DbGridControl_Base::RemoveColumn(nId);
 
+    if (nIndex == GRID_COLUMN_NOT_FOUND)
+        return;
+
     delete m_aColumns[ nIndex ];
     DbGridColumns::iterator it = m_aColumns.begin();
     ::std::advance( it, nIndex );


now attempts to unconditionally remove any column nId. I don't know if
and how the underlying code handles such cases, but a safer approach
would be to still check for a valid index and additionally the handle
column case, so

    if (nIndex != GRID_COLUMN_NOT_FOUND || nId == 0)
        DbGridControl_Base::RemoveColumn(nId);

might be better suited.

  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD

Attachment: signature.asc
Description: Digital signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.