dbaccess/source/core/api/KeySet.cxx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
New commits: commit 38786a76cf3dbc421635d40354e8c9ece409c6c5 Author: Lionel Elie Mamane <lio...@mamane.lu> Date: Fri Jun 1 11:42:53 2012 +0200 fdo#50372: crash when refresh of last already-known row unexpectedly fails Instead, try to do the least unreasonable thing: Fetch a new row If that fails because no new row to fetch, at least we are properly positioned after last row. Calling code may not expect that and get confused, but that is the best we can do. Change-Id: Ib7248e99ae3deee8344e9386cac2c9440e8bccd8 diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx index 74b8b17..881da40 100644 --- a/dbaccess/source/core/api/KeySet.cxx +++ b/dbaccess/source/core/api/KeySet.cxx @@ -1375,10 +1375,23 @@ void SAL_CALL OKeySet::refreshRow() throw(SQLException, RuntimeException) sal_Bool bOK = m_xSet->next(); if ( !bOK ) { + // This row has disappeared; remove it. OKeySetMatrix::iterator aTemp = m_aKeyIter; + // use *next* row ++m_aKeyIter; m_aKeyMap.erase(aTemp); - --m_rRowCount; + + // adjust RowCount for the row we have removed + if (m_rRowCount > 0) + --m_rRowCount; + else + OSL_FAIL("m_rRowCount got out of sync: non-empty m_aKeyMap, but m_rRowCount <= 0"); + + if (!isAfterLast()) + { + // it was the last row, but there may be another one to fetch + fetchRow(); + } refreshRow(); } else _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits