[Libreoffice-commits] .: 2 commits - writerfilter/source
David Tardon
dtardon at kemper.freedesktop.org
Mon May 14 06:02:10 PDT 2012
writerfilter/source/dmapper/DomainMapper_Impl.cxx | 3 +++
writerfilter/source/filter/RtfFilter.cxx | 14 +++++++++-----
2 files changed, 12 insertions(+), 5 deletions(-)
New commits:
commit a360d5901565fe498cc932023dc8e37e92dc3ad5
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 14 14:48:00 2012 +0200
hide progress bar even if loading failed
Change-Id: Ia330e70e393309dbbad025fc2ede8f4ab41a674c
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index 0f37279..7e862c8 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -69,6 +69,9 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
return xFltr->filter(aDescriptor);
}
+ sal_Bool bResult(sal_False);
+ uno::Reference<task::XStatusIndicator> xStatusIndicator;
+
try
{
MediaDescriptor aMediaDesc( aDescriptor );
@@ -89,7 +92,7 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
uno::Reference<frame::XFrame> xFrame = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_FRAME(),
uno::Reference<frame::XFrame>());
- uno::Reference<task::XStatusIndicator> xStatusIndicator = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_STATUSINDICATOR(),
+ xStatusIndicator = aMediaDesc.getUnpackedValueOrDefault(MediaDescriptor::PROP_STATUSINDICATOR(),
uno::Reference<task::XStatusIndicator>());
writerfilter::Stream::Pointer_t pStream(
@@ -97,20 +100,21 @@ sal_Bool RtfFilter::filter( const uno::Sequence< beans::PropertyValue >& aDescri
writerfilter::rtftok::RTFDocument::Pointer_t const pDocument(
writerfilter::rtftok::RTFDocumentFactory::createDocument(m_xContext, xInputStream, m_xDstDoc, xFrame, xStatusIndicator));
pDocument->resolve(*pStream);
+ bResult = sal_True;
#ifdef DEBUG_IMPORT
dmapperLogger->endDocument();
#endif
- if (xStatusIndicator.is())
- xStatusIndicator->end();
sal_uInt32 nEndTime = osl_getGlobalTimer();
SAL_INFO("writerfilter.profile", OSL_THIS_FUNC << " finished in " << nEndTime - nStartTime << " ms");
- return sal_True;
}
catch (const uno::Exception& e)
{
SAL_INFO("writerfilter", "Exception caught: " << e.Message);
- return sal_False;
}
+
+ if (xStatusIndicator.is())
+ xStatusIndicator->end();
+ return bResult;
}
void RtfFilter::cancel( ) throw (uno::RuntimeException)
commit dfe0baa281d9d4701e9b3846880334213ccb05f5
Author: David Tardon <dtardon at redhat.com>
Date: Mon May 14 14:42:22 2012 +0200
do not crash when opening rtf file with unclosed field group
It still fails to load the file (General input/output error), because
RTFDocumentImpl::resolve() throws io::UnexpectedEOFException, but that
is a bit better than a crash .-)
Example of such a file can be found in fdo#49666 or rhbz#819304 .
Change-Id: I I1e575bf8e3194afe063297a4daf3e98eaaa510cc
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 3c4e8eb..c73b1cc 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3137,6 +3137,9 @@ void DomainMapper_Impl::PopFieldContext()
dmapper_logger->element("popFieldContext");
#endif
+ if (m_aFieldStack.empty())
+ return;
+
FieldContextPtr pContext = m_aFieldStack.top();
OSL_ENSURE( pContext.get(), "no field context available");
if( pContext.get() )
More information about the Libreoffice-commits
mailing list