Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1858
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/58/1858/1
bnc#798271: Don't delete the PropertyMapEntry instance prematurely.
When using comphelper::PropertyMapEntry array to create a UNO property
set, we need to make sure we keep this instance while the property set
object is alive, else it would cause a very hard-to-debug problem down
the road...
In this particular case, the aExportInfoMap array instance was destroyed
when it went out of scope, but the xInfoSet which references it was used
afterward.
Change-Id: I02132b6b2e6bef7b461f0f77c2c4a3e911e42014
---
M chart2/source/model/filter/XMLFilter.cxx
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 10a565a..75692c4 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -631,28 +631,26 @@
xServiceFactory->createInstanceWithArguments(
C2U("com.sun.star.comp.Svx.GraphicExportHelper"), aGraphicResolverArgs ),
uno::UNO_QUERY );
- uno::Reference< beans::XPropertySet > xInfoSet;
+ // property map for export info set
+ comphelper::PropertyMapEntry aExportInfoMap[] =
{
- // property map for export info set
- comphelper::PropertyMapEntry aExportInfoMap[] =
- {
- { MAP_LEN("UsePrettyPrinting"), 0, &::getBooleanCppuType(),
beans::PropertyAttribute::MAYBEVOID, 0},
- { MAP_LEN("BaseURI"), 0, &::getCppuType( (OUString *)0 ),
beans::PropertyAttribute::MAYBEVOID, 0 },
- { MAP_LEN("StreamRelPath"), 0, &::getCppuType( (OUString *)0 ),
beans::PropertyAttribute::MAYBEVOID, 0 },
- { MAP_LEN("StreamName"), 0, &::getCppuType( (OUString *)0 ),
beans::PropertyAttribute::MAYBEVOID, 0 },
- { MAP_LEN("ExportTableNumberList"), 0, &::getBooleanCppuType(),
beans::PropertyAttribute::MAYBEVOID, 0 },
- { NULL, 0, 0, NULL, 0, 0 }
- };
+ { MAP_LEN("UsePrettyPrinting"), 0, &::getBooleanCppuType(),
beans::PropertyAttribute::MAYBEVOID, 0},
+ { MAP_LEN("BaseURI"), 0, &::getCppuType( (OUString *)0 ),
beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN("StreamRelPath"), 0, &::getCppuType( (OUString *)0 ),
beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN("StreamName"), 0, &::getCppuType( (OUString *)0 ),
beans::PropertyAttribute::MAYBEVOID, 0 },
+ { MAP_LEN("ExportTableNumberList"), 0, &::getBooleanCppuType(),
beans::PropertyAttribute::MAYBEVOID, 0 },
+ { NULL, 0, 0, NULL, 0, 0 }
+ };
- xInfoSet = comphelper::GenericPropertySet_CreateInstance( new
comphelper::PropertySetInfo( aExportInfoMap ) );
+ uno::Reference< beans::XPropertySet > xInfoSet =
+ comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo(
aExportInfoMap ) );
- SvtSaveOptions aSaveOpt;
- OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
- sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
- xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny( bUsePrettyPrinting ) );
- if( ! bOasis )
- xInfoSet->setPropertyValue( C2U("ExportTableNumberList"), uno::makeAny( true ));
- }
+ SvtSaveOptions aSaveOpt;
+ OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
+ sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
+ xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny( bUsePrettyPrinting ) );
+ if( ! bOasis )
+ xInfoSet->setPropertyValue( C2U("ExportTableNumberList"), uno::makeAny( true ));
sal_Int32 nArgs = 2;
if( xGraphicObjectResolver.is())
--
To view, visit https://gerrit.libreoffice.org/1858
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I02132b6b2e6bef7b461f0f77c2c4a3e911e42014
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Kohei Yoshida <kohei.yoshida@gmail.com>
Context
- [PATCH] Change in core[libreoffice-4-0]: bnc#798271: Don't delete the PropertyMapEntry instance prema... · Kohei Yoshida (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.