[Libreoffice-commits] core.git: Branch 'libreoffice-4-3-7' - desktop/source
Stephan Bergmann
sbergman at redhat.com
Sat Apr 11 13:23:18 PDT 2015
desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 21 +++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
New commits:
commit 07e71d1e222c4d63a1a529e2d8d0277e05b0bf57
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Apr 10 15:06:53 2015 +0200
rhbz#1197614: Fix calculation of m_bHasActive when removing active element
Assume m_vEntries.size() == 2; assume first element (nPos == 0) is m_bActive,
gets removed, so m_nActive would have stayed at 0 and m_bHasActive at true; then
assume second element (again nPos == 0, due to the removed element) is m_bNew,
so nPos <= m_nActive is true and m_nActive gets updated to 1 (and m_bHasActive
remains true); then selectEntry(nNewPos) (nNewPos == 0) would have tried to
reset m_vEntries[1]->m_bActive but now m_vEntries.size() == 1.
Change-Id: I31d3bbe97ca99f880aa99bdea015f7c0457f8331
(cherry picked from commit 97d4c1a8100c63091401736c93d6bbbb371d5b37)
Reviewed-on: https://gerrit.libreoffice.org/15232
Tested-by: David Tardon <dtardon at redhat.com>
Reviewed-by: David Tardon <dtardon at redhat.com>
(cherry picked from commit 816f949607c0e372f73ad87fe44b086b27235a01)
Reviewed-on: https://gerrit.libreoffice.org/15236
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 42ecca1..42aa6b6 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -1062,7 +1062,6 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &
//access to m_nActive must be guarded
if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
m_nActive += 1;
-
guard.clear();
if ( IsReallyVisible() )
@@ -1199,6 +1198,7 @@ void ExtensionBox_Impl::prepareChecking()
void ExtensionBox_Impl::checkEntries()
{
long nNewPos = -1;
+ long nChangedActivePos = -1;
long nPos = 0;
bool bNeedsUpdate = false;
@@ -1222,15 +1222,19 @@ void ExtensionBox_Impl::checkEntries()
}
else
{ // remove entry from list
+ if (nPos < nNewPos) {
+ --nNewPos;
+ }
+ if (nPos < nChangedActivePos) {
+ --nChangedActivePos;
+ }
if ( nPos < m_nActive )
m_nActive -= 1;
- else if ( ( nPos == m_nActive ) && ( nPos == (long) m_vEntries.size() - 1 ) )
+ else if ( nPos == m_nActive )
{
- m_nActive -= 1;
- if (m_nActive == -1)
- {
- m_bHasActive = false;
- }
+ nChangedActivePos = nPos;
+ m_nActive = -1;
+ m_bHasActive = false;
}
m_vRemovedEntries.push_back( *iIndex );
m_vEntries.erase( iIndex );
@@ -1246,6 +1250,9 @@ void ExtensionBox_Impl::checkEntries()
if ( nNewPos != - 1)
selectEntry( nNewPos );
+ else if (nChangedActivePos != -1) {
+ selectEntry(nChangedActivePos);
+ }
if ( bNeedsUpdate )
{
More information about the Libreoffice-commits
mailing list