Attached patch fixes fdo#48345, namely that when one scrolls back in a
table view, a wrong line is shown. See screenshot at
https://bugs.freedesktop.org/attachment.cgi?id=61072
and detailed analysis at
https://bugs.freedesktop.org/show_bug.cgi?id=48345#c2

Briefly, OKeySet->next() did not refresh the row after moving to the
next row, only in the case where not all data was fetched yet. So we
still had another row there, and that's the one that was shown. The
first patch makes OKeySet->next() refresh the row always.

The second patch is cleanup and should probably not go to 3.5;
however, the version I tested is with *both* patches applied, so
<shrug>. If you are willing to test with only the first patch, then by
all means apply only the first.

-- 
Lionel
>From 8fca982829c03995e74faf17e5777b3aa61b91dc Mon Sep 17 00:00:00 2001
From: Lionel Elie Mamane <lio...@mamane.lu>
Date: Tue, 15 May 2012 18:36:12 +0200
Subject: [PATCH 1/2] fdo#48345 need to refresh row also when not
 m_bRowCountFinal

---
 dbaccess/source/core/api/KeySet.cxx |    7 +------
 1 files changed, 1 insertions(+), 6 deletions(-)

diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 309d6d8..49edcbf 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -1108,14 +1108,9 @@ sal_Bool SAL_CALL OKeySet::next(  ) throw(SQLException, RuntimeException)
     if(!m_bRowCountFinal) // not yet all records fetched
     {
         ++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row
+                      // LEM: above comment is wrong; we may be anywhere but after last.
         if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
             m_aKeyIter = m_aKeyMap.end();
-        else
-        {
-            //m_aKeyIter->second.second.second = new OPrivateRow(_rInsertRow->get());
-            m_xRow.set(m_xDriverRow,UNO_QUERY_THROW);
-            return !isAfterLast();
-        }
     }
     else if(!isAfterLast())
         ++m_aKeyIter;
-- 
1.7.7.3

>From 2ffe693d7e1f9710815b946112b34e2aec5450e5 Mon Sep 17 00:00:00 2001
From: Lionel Elie Mamane <lio...@mamane.lu>
Date: Tue, 15 May 2012 18:37:43 +0200
Subject: [PATCH 2/2] simplify/clarify code

---
 dbaccess/source/core/api/KeySet.cxx |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/dbaccess/source/core/api/KeySet.cxx b/dbaccess/source/core/api/KeySet.cxx
index 49edcbf..26112cf 100644
--- a/dbaccess/source/core/api/KeySet.cxx
+++ b/dbaccess/source/core/api/KeySet.cxx
@@ -1105,15 +1105,12 @@ sal_Bool SAL_CALL OKeySet::next(  ) throw(SQLException, RuntimeException)
 
     if(isAfterLast())
         return sal_False;
+    ++m_aKeyIter;
     if(!m_bRowCountFinal) // not yet all records fetched
     {
-        ++m_aKeyIter; // this is possible because we stand on begin() and this is the "beforefirst" row
-                      // LEM: above comment is wrong; we may be anywhere but after last.
         if(m_aKeyIter == m_aKeyMap.end() && !fetchRow())
             m_aKeyIter = m_aKeyMap.end();
     }
-    else if(!isAfterLast())
-        ++m_aKeyIter;
 
     refreshRow();
     return !isAfterLast();
-- 
1.7.7.3

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to