Resolves: rhbz#1197614 crash when updating extension

f41
Stephan Bergmann 10 years ago
parent 7c702e2d3e
commit 0d4f7c12f2

@ -0,0 +1,77 @@
From 97d4c1a8100c63091401736c93d6bbbb371d5b37 Mon Sep 17 00:00:00 2001
From: Stephan Bergmann <sbergman@redhat.com>
Date: Fri, 10 Apr 2015 15:06:53 +0200
Subject: [PATCH] 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
---
desktop/source/deployment/gui/dp_gui_extlistbox.cxx | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 260100f..b9500a1 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -1035,7 +1035,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() )
@@ -1172,6 +1171,7 @@ void ExtensionBox_Impl::prepareChecking()
void ExtensionBox_Impl::checkEntries()
{
long nNewPos = -1;
+ long nChangedActivePos = -1;
long nPos = 0;
bool bNeedsUpdate = false;
@@ -1195,15 +1195,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 );
@@ -1219,6 +1223,9 @@ void ExtensionBox_Impl::checkEntries()
if ( nNewPos != - 1)
selectEntry( nNewPos );
+ else if (nChangedActivePos != -1) {
+ selectEntry(nChangedActivePos);
+ }
if ( bNeedsUpdate )
{
--
2.1.0

@ -48,7 +48,7 @@ Summary: Free Software Productivity Suite
Name: libreoffice
Epoch: 1
Version: %{libo_version}.2
Release: 2%{?libo_prerelease}%{?dist}
Release: 3%{?libo_prerelease}%{?dist}
License: (MPLv1.1 or LGPLv3+) and LGPLv3 and LGPLv2+ and BSD and (MPLv1.1 or GPLv2 or LGPLv2 or Netscape) and Public Domain and ASL 2.0 and Artistic and MPLv2.0 and CC0
Group: Applications/Productivity
URL: http://www.libreoffice.org/
@ -325,6 +325,7 @@ Patch25: 0001-Resolves-rhbz-1204244-group-sdb-windows-together-as-.patch
Patch26: 0001-Resolves-tdf-90256-repair-invalid-docking-positions.patch
Patch27: 0001-gnome-745909-grab-ungrab-keyboard-for-menus.patch
Patch28: 0001-negative-after-text-indents-ignored-by-msword-for-ap.patch
Patch29: 0001-rhbz-1197614-Fix-calculation-of-m_bHasActive-when-re.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@ -2366,6 +2367,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%endif
%changelog
* Fri Apr 10 2015 Stephan Bergmann <sbergman@redhat.com> - 1:4.4.2.2-3-UNBUILT
- Resolves: rhbz#1197614 crash when updating extension
* Mon Mar 30 2015 Richard Hughes <rhughes@redhat.com> - 1:4.4.2.2-2
- Use better AppData screenshots

Loading…
Cancel
Save