summaryrefslogtreecommitdiff
path: root/sfx2/source/view
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-07-22 11:11:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-07-23 11:22:59 +0200
commit4e512171c21a193027c35d19a5273507a2725596 (patch)
treee0c354208a355c22f0e0ba9639b10a1010b2a52f /sfx2/source/view
parent58ddacdb4be78dd00e05a46459ed0bcbe7531632 (diff)
no need to allocate these static vars on demand
the constructor can be laid out at compile/link time Change-Id: I377a537e15199ae81394d76ac662576280a25c25 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119362 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/view')
-rw-r--r--sfx2/source/view/frame.cxx20
1 files changed, 8 insertions, 12 deletions
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index a99e9dead483..3c3b68f0a628 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -51,7 +51,7 @@
using namespace com::sun::star;
-static std::vector<SfxFrame*>* pFramesArr_Impl=nullptr;
+static std::vector<SfxFrame*> gaFramesArr_Impl;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::util;
@@ -71,9 +71,7 @@ SfxPoolItem* SfxUnoFrameItem::CreateDefault()
void SfxFrame::Construct_Impl()
{
pImpl.reset(new SfxFrame_Impl);
- if ( !pFramesArr_Impl )
- pFramesArr_Impl = new std::vector<SfxFrame*>;
- pFramesArr_Impl->push_back( this );
+ gaFramesArr_Impl.push_back( this );
}
@@ -82,9 +80,9 @@ SfxFrame::~SfxFrame()
RemoveTopFrame_Impl( this );
pWindow.disposeAndClear();
- auto it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), this );
- if ( it != pFramesArr_Impl->end() )
- pFramesArr_Impl->erase( it );
+ auto it = std::find( gaFramesArr_Impl.begin(), gaFramesArr_Impl.end(), this );
+ if ( it != gaFramesArr_Impl.end() )
+ gaFramesArr_Impl.erase( it );
delete pImpl->pDescr;
}
@@ -717,15 +715,13 @@ void SfxFrame::Resize()
SfxFrame* SfxFrame::GetFirst()
{
- if ( !pFramesArr_Impl )
- return nullptr;
- return pFramesArr_Impl->empty() ? nullptr : pFramesArr_Impl->front();
+ return gaFramesArr_Impl.empty() ? nullptr : gaFramesArr_Impl.front();
}
SfxFrame* SfxFrame::GetNext( SfxFrame& rFrame )
{
- auto it = std::find( pFramesArr_Impl->begin(), pFramesArr_Impl->end(), &rFrame );
- if ( it != pFramesArr_Impl->end() && (++it) != pFramesArr_Impl->end() )
+ auto it = std::find( gaFramesArr_Impl.begin(), gaFramesArr_Impl.end(), &rFrame );
+ if ( it != gaFramesArr_Impl.end() && (++it) != gaFramesArr_Impl.end() )
return *it;
else
return nullptr;