[Libreoffice] [REVIEW] fdo#40701 Base crashes when "Find Record" button is clicked
Eike Rathke
ooo at erack.de
Sun Sep 11 16:07:53 PDT 2011
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20110912/dfe40f21/attachment.pgp>
More information about the LibreOffice
mailing list