No subject
Sun Sep 11 22:12:19 PDT 2011
uInt16 nId = ...;
try
{
addColumTo_pCols(nId, ...);
// some code that may throw
(...)
addColumnTo_m_aColumns(nId, ...);
}
catch (...)
{
removeColumn(nId);
throw;
}
And actually, now that this is clear in my mind, I think the patch
should be, for more clarity:
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 );
This makes it more clear that the call to
DbGridControl_Base::RemoveColumn and the result of
GetModelColumnPos(nId) are meant to be completely independent.
--
Lionel
More information about the LibreOffice
mailing list