Kaydet (Commit) dceedfdc authored tarafından Kohei Yoshida's avatar Kohei Yoshida Kaydeden (comit) Noel Power

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
Reviewed-on: https://gerrit.libreoffice.org/1858Reviewed-by: 's avatarNoel Power <noel.power@suse.com>
Tested-by: 's avatarNoel Power <noel.power@suse.com>
üst fd96008b
...@@ -631,28 +631,26 @@ sal_Int32 XMLFilter::impl_Export( ...@@ -631,28 +631,26 @@ sal_Int32 XMLFilter::impl_Export(
xServiceFactory->createInstanceWithArguments( xServiceFactory->createInstanceWithArguments(
C2U("com.sun.star.comp.Svx.GraphicExportHelper"), aGraphicResolverArgs ), uno::UNO_QUERY ); 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 { MAP_LEN("UsePrettyPrinting"), 0, &::getBooleanCppuType(), beans::PropertyAttribute::MAYBEVOID, 0},
comphelper::PropertyMapEntry aExportInfoMap[] = { MAP_LEN("BaseURI"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
{ { MAP_LEN("StreamRelPath"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
{ MAP_LEN("UsePrettyPrinting"), 0, &::getBooleanCppuType(), beans::PropertyAttribute::MAYBEVOID, 0}, { MAP_LEN("StreamName"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 },
{ MAP_LEN("BaseURI"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { MAP_LEN("ExportTableNumberList"), 0, &::getBooleanCppuType(), beans::PropertyAttribute::MAYBEVOID, 0 },
{ MAP_LEN("StreamRelPath"), 0, &::getCppuType( (OUString *)0 ), beans::PropertyAttribute::MAYBEVOID, 0 }, { NULL, 0, 0, NULL, 0, 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 ) );
xInfoSet = comphelper::GenericPropertySet_CreateInstance( new comphelper::PropertySetInfo( aExportInfoMap ) ); SvtSaveOptions aSaveOpt;
OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting"));
SvtSaveOptions aSaveOpt; sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() );
OUString sUsePrettyPrinting(RTL_CONSTASCII_USTRINGPARAM("UsePrettyPrinting")); xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny( bUsePrettyPrinting ) );
sal_Bool bUsePrettyPrinting( aSaveOpt.IsPrettyPrinting() ); if( ! bOasis )
xInfoSet->setPropertyValue( sUsePrettyPrinting, uno::makeAny( bUsePrettyPrinting ) ); xInfoSet->setPropertyValue( C2U("ExportTableNumberList"), uno::makeAny( true ));
if( ! bOasis )
xInfoSet->setPropertyValue( C2U("ExportTableNumberList"), uno::makeAny( true ));
}
sal_Int32 nArgs = 2; sal_Int32 nArgs = 2;
if( xGraphicObjectResolver.is()) if( xGraphicObjectResolver.is())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment