[Libreoffice-commits] core.git: 2 commits - include/comphelper sw/inc sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Mon Apr 9 06:37:20 UTC 2018
include/comphelper/weakbag.hxx | 12 +++++-------
sw/inc/accmap.hxx | 5 ++---
sw/source/core/access/accmap.cxx | 14 +++-----------
3 files changed, 10 insertions(+), 21 deletions(-)
New commits:
commit 6b88669498eafbe75eb3667f5997886e8b99ded7
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Sat Apr 7 09:40:08 2018 +0200
std::list->std::vector in SwAccessibleMap
Change-Id: I8820405b7565e8ec4aff72bd24ddd252d95422e5
Reviewed-on: https://gerrit.libreoffice.org/52530
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sw/inc/accmap.hxx b/sw/inc/accmap.hxx
index 5ed3fcfae7e3..f4ed96f3fc59 100644
--- a/sw/inc/accmap.hxx
+++ b/sw/inc/accmap.hxx
@@ -29,7 +29,6 @@
#include <svx/AccessibleControlShape.hxx>
#include <o3tl/typed_flags_set.hxx>
-#include <list>
#include <vector>
#include <memory>
#include <set>
@@ -67,7 +66,7 @@ namespace vcl { class Window; }
// the XShape at the same time (indirectly by destroying the accessible
// shape) leads to an assert, because a client of the Modify is destroyed
// within a Modify call.
-using SwShapeList_Impl = std::list<css::uno::Reference<css::drawing::XShape>>;
+using SwShapeList_Impl = std::vector<css::uno::Reference<css::drawing::XShape>>;
enum class AccessibleStates
{
@@ -95,7 +94,7 @@ class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
::osl::Mutex maEventMutex;
SwAccessibleContextMap_Impl *mpFrameMap;
SwAccessibleShapeMap_Impl *mpShapeMap;
- SwShapeList_Impl *mpShapes;
+ SwShapeList_Impl mvShapes;
SwAccessibleEventList_Impl *mpEvents;
SwAccessibleEventMap_Impl *mpEventMap;
// #i27301 data structure to keep information about
diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx
index dbfa3a76f9a3..712b70873507 100644
--- a/sw/source/core/access/accmap.cxx
+++ b/sw/source/core/access/accmap.cxx
@@ -1636,7 +1636,6 @@ void SwAccessibleMap::DoInvalidateShapeFocus()
SwAccessibleMap::SwAccessibleMap( SwViewShell *pSh ) :
mpFrameMap( nullptr ),
mpShapeMap( nullptr ),
- mpShapes( nullptr ),
mpEvents( nullptr ),
mpEventMap( nullptr ),
mpSelectedParas( nullptr ),
@@ -1699,8 +1698,7 @@ SwAccessibleMap::~SwAccessibleMap()
mpFrameMap = nullptr;
delete mpShapeMap;
mpShapeMap = nullptr;
- delete mpShapes;
- mpShapes = nullptr;
+ mvShapes.clear();
delete mpSelectedParas;
mpSelectedParas = nullptr;
}
@@ -2237,9 +2235,7 @@ void SwAccessibleMap::A11yDispose( const SwFrame *pFrame,
uno::UNO_QUERY );
if( xShape.is() )
{
- if( !mpShapes )
- mpShapes = new SwShapeList_Impl;
- mpShapes->push_back( xShape );
+ mvShapes.push_back( xShape );
}
}
}
@@ -3024,11 +3020,7 @@ void SwAccessibleMap::FireEvents()
}
{
osl::MutexGuard aGuard( maMutex );
- if( mpShapes )
- {
- delete mpShapes;
- mpShapes = nullptr;
- }
+ mvShapes.clear();
}
}
commit 919ffe3715c8583f0ee329e32bb6163608911d22
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date: Sat Apr 7 09:31:50 2018 +0200
std::list->std::vector in WeakBag
Change-Id: Ic0f0c89cb27fab4d30da1276fb8dc3ad1981a80d
Reviewed-on: https://gerrit.libreoffice.org/52529
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/include/comphelper/weakbag.hxx b/include/comphelper/weakbag.hxx
index f23f9227057e..981a6c834e36 100644
--- a/include/comphelper/weakbag.hxx
+++ b/include/comphelper/weakbag.hxx
@@ -22,7 +22,7 @@
#include <sal/config.h>
-#include <list>
+#include <vector>
#include <com/sun/star/uno/Reference.hxx>
#include <cppuhelper/weakref.hxx>
#include <osl/diagnose.h>
@@ -46,7 +46,7 @@ public:
*/
void add(css::uno::Reference< T > const & e) {
OSL_ASSERT(e.is());
- for (typename WeakReferenceList::iterator i(m_list.begin()); i != m_list.end();) {
+ for (auto i = m_list.begin(); i != m_list.end();) {
if (css::uno::Reference< T >(*i).is()) {
++i;
} else {
@@ -64,8 +64,8 @@ public:
*/
css::uno::Reference< T > remove() {
while (!m_list.empty()) {
- css::uno::Reference< T > r(m_list.front());
- m_list.pop_front();
+ css::uno::Reference< T > r(m_list.back());
+ m_list.pop_back();
if (r.is()) {
return r;
}
@@ -74,9 +74,7 @@ public:
}
private:
- typedef std::list< css::uno::WeakReference< T > > WeakReferenceList;
-
- WeakReferenceList m_list;
+ std::vector< css::uno::WeakReference< T > > m_list;
};
}
More information about the Libreoffice-commits
mailing list