[Libreoffice-commits] core.git: include/sfx2 sfx2/source
Mark Page
aptitude at btconnect.com
Wed Jun 8 10:59:54 UTC 2016
include/sfx2/module.hxx | 3 +++
include/sfx2/msgpool.hxx | 3 +--
sfx2/source/appl/module.cxx | 4 ++--
sfx2/source/control/msgpool.cxx | 4 ++--
4 files changed, 8 insertions(+), 6 deletions(-)
New commits:
commit 5164ac456f3cb51949fe3bec293660fab74d26de
Author: Mark Page <aptitude at btconnect.com>
Date: Tue Jun 7 09:09:07 2016 +0100
tdf#96099 Remove SfxInterfaceArr_Impl typedef
Added comment in SfxModule with warning about using smart pointers
Change-Id: I1997d41a0a77c7e82e486bcdaee0ea876fdc61ad
Reviewed-on: https://gerrit.libreoffice.org/25999
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin at gmail.com>
diff --git a/include/sfx2/module.hxx b/include/sfx2/module.hxx
index 7871675..72f25f5 100644
--- a/include/sfx2/module.hxx
+++ b/include/sfx2/module.hxx
@@ -53,6 +53,9 @@ class SFX2_DLLPUBLIC SfxModule : public SfxShell
{
private:
ResMgr* pResMgr;
+
+ // Warning this cannot be turned into a unique_ptr.
+ // SfxInterface destruction in the SfxSlotPool refers again to pImpl after deletion of pImpl has commenced. See tdf#100270
SfxModule_Impl* pImpl;
SAL_DLLPRIVATE void Construct_Impl();
diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx
index b4ff132..d38a73c 100644
--- a/include/sfx2/msgpool.hxx
+++ b/include/sfx2/msgpool.hxx
@@ -31,13 +31,12 @@ class SfxInterface;
class SfxSlot;
typedef std::basic_string< sal_uInt16 > SfxSlotGroupArr_Impl;
-typedef std::vector<SfxInterface*> SfxInterfaceArr_Impl;
class SFX2_DLLPUBLIC SfxSlotPool
{
std::unique_ptr<SfxSlotGroupArr_Impl> _pGroups;
SfxSlotPool* _pParentPool;
- std::unique_ptr<SfxInterfaceArr_Impl> _pInterfaces;
+ std::unique_ptr< std::vector<SfxInterface*> > _pInterfaces;
sal_uInt16 _nCurGroup;
sal_uInt16 _nCurInterface;
sal_uInt16 _nCurMsg;
diff --git a/sfx2/source/appl/module.cxx b/sfx2/source/appl/module.cxx
index bb1730d..3978723 100644
--- a/sfx2/source/appl/module.cxx
+++ b/sfx2/source/appl/module.cxx
@@ -92,7 +92,8 @@ ImageList* SfxModule_Impl::GetImageList( ResMgr* pResMgr, bool bBig )
rpList = new ImageList();
}
- return rpList; }
+ return rpList;
+}
SFX_IMPL_SUPERCLASS_INTERFACE(SfxModule, SfxShell)
@@ -147,7 +148,6 @@ SfxModule::~SfxModule()
break;
}
}
-
}
delete pImpl;
diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx
index eb38323..ab832d6 100644
--- a/sfx2/source/control/msgpool.cxx
+++ b/sfx2/source/control/msgpool.cxx
@@ -55,7 +55,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface )
{
// add to the list of SfxObjectInterface instances
if(!_pInterfaces)
- _pInterfaces.reset(new SfxInterfaceArr_Impl);
+ _pInterfaces.reset(new std::vector<SfxInterface*> );
_pInterfaces->push_back(&rInterface);
// Stop at a (single) Null-slot (for syntactic reasons the interfaces
@@ -106,7 +106,7 @@ void SfxSlotPool::ReleaseInterface( SfxInterface& rInterface )
return ;
// remove from the list of SfxInterface instances
- SfxInterfaceArr_Impl::iterator i = std::find(_pInterfaces->begin(), _pInterfaces->end(), &rInterface);
+ auto i = std::find(_pInterfaces->begin(), _pInterfaces->end(), &rInterface);
if(i != _pInterfaces->end())
_pInterfaces->erase(i);
}
More information about the Libreoffice-commits
mailing list