summaryrefslogtreecommitdiff
path: root/extensions
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-11 06:43:06 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2016-03-11 06:38:15 +0000
commite94d5233dd7939c54eb52fff456e817cecdf0a4c (patch)
tree24acd3465e88b1a2a26246272a41236edfbe9b21 /extensions
parentfb827f2a342602f7e62dbdebb638326193315eb6 (diff)
work on sane lifecylce for SfxFilter
all SfxFilter instances should now be hold inside of a std::shared_ptr. This fixes a number of huge memory leaks in the test framework and removes one huge source of memory issue in sfx2. SfxMedium contains a pointer to the SfxFilter but does not own. Therefore it is required that any SfxFilter belonging to a SfxMedium lives longer. However this seems to work mostly by hoping that all SfxFilter instances are stored in a global array. As we have seen with the tests this is not true (there are also some cases inside of sd that seem to not follow that pattern as well). Change-Id: I12fd04a504cc4efc0a94967abd91c6fe2c6a8ce8 Reviewed-on: https://gerrit.libreoffice.org/23140 Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com> Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'extensions')
-rw-r--r--extensions/source/abpilot/abpfinalpage.cxx6
-rw-r--r--extensions/source/dbpilots/commonpagesdbp.cxx2
-rw-r--r--extensions/source/propctrlr/formcomponenthandler.cxx2
3 files changed, 5 insertions, 5 deletions
diff --git a/extensions/source/abpilot/abpfinalpage.cxx b/extensions/source/abpilot/abpfinalpage.cxx
index d51c35678aff..9c2e48ef6131 100644
--- a/extensions/source/abpilot/abpfinalpage.cxx
+++ b/extensions/source/abpilot/abpfinalpage.cxx
@@ -35,9 +35,9 @@ namespace abp
using namespace ::svt;
using namespace ::utl;
- const SfxFilter* lcl_getBaseFilter()
+ std::shared_ptr<const SfxFilter> lcl_getBaseFilter()
{
- const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
+ std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
return pFilter;
}
@@ -111,7 +111,7 @@ namespace abp
sPath += "/";
sPath += rSettings.sDataSourceName;
- const SfxFilter* pFilter = lcl_getBaseFilter();
+ std::shared_ptr<const SfxFilter> pFilter = lcl_getBaseFilter();
if ( pFilter )
{
OUString sExt = pFilter->GetDefaultExtension();
diff --git a/extensions/source/dbpilots/commonpagesdbp.cxx b/extensions/source/dbpilots/commonpagesdbp.cxx
index dbd3ed256af9..3a7b53cfebe0 100644
--- a/extensions/source/dbpilots/commonpagesdbp.cxx
+++ b/extensions/source/dbpilots/commonpagesdbp.cxx
@@ -199,7 +199,7 @@ namespace dbp
ui::dialogs::TemplateDescription::FILEOPEN_READONLY_VERSION, 0);
aFileDlg.SetDisplayDirectory( SvtPathOptions().GetWorkPath() );
- const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
+ std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
if ( pFilter )
{
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index b544f622c4f2..c44d3d9f74fa 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -2900,7 +2900,7 @@ namespace pcr
// is considered to be potentially expensive
aFileDlg.SetDisplayDirectory( sDataSource );
- const SfxFilter* pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
+ std::shared_ptr<const SfxFilter> pFilter = SfxFilter::GetFilterByName("StarOffice XML (Base)");
OSL_ENSURE(pFilter,"Filter: StarOffice XML (Base) could not be found!");
if ( pFilter )
{