summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@gmail.com>2013-01-24 22:24:44 -0500
committerKohei Yoshida <kohei.yoshida@gmail.com>2013-01-25 00:22:36 -0500
commit4153bcbc8e568e8e33c56bab68e9ea036c5dce5b (patch)
treee22b8ff9c6e37fcdf7d4725b37d0bc6da48c0d4f /chart2
parentfb422f088e249328bac0267dc6ee7b94146e3bd5 (diff)
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
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/model/filter/XMLFilter.cxx40
1 files changed, 19 insertions, 21 deletions
diff --git a/chart2/source/model/filter/XMLFilter.cxx b/chart2/source/model/filter/XMLFilter.cxx
index 2a6e35b3df84..551e9b29daa3 100644
--- a/chart2/source/model/filter/XMLFilter.cxx
+++ b/chart2/source/model/filter/XMLFilter.cxx
@@ -644,28 +644,26 @@ sal_Int32 XMLFilter::impl_Export(
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 }
- };
-
- 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 ));
- }
+ { 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 }
+ };
+
+ 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 ));
sal_Int32 nArgs = 2;
if( xGraphicObjectResolver.is())