From cf0ef681854ad53a0bdeff31ff5c49c8c31da99b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Mon, 8 Oct 2012 17:45:49 +0200 Subject: [PATCH] SwXTextDocument::getFlatParagraphIterator: fix crash: Check if the document is still valid. Crash in idle handler grammar checker observed on libreoffice-3-5 branch. Change-Id: I3cae1c6726bb9ad5be11f59bc33f8550bbbe1883 --- sw/source/ui/uno/unotxdoc.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx index ef09ecf5a026..52d989de90e7 100644 --- a/sw/source/ui/uno/unotxdoc.cxx +++ b/sw/source/ui/uno/unotxdoc.cxx @@ -3033,6 +3033,12 @@ uno::Reference< text::XFlatParagraphIterator > SAL_CALL SwXTextDocument::getFlat throw ( uno::RuntimeException ) { SolarMutexGuard aGuard; + if (!IsValid()) + { + throw DisposedException("SwXTextDocument not valid", + static_cast(this)); + } + return new SwXFlatParagraphIterator( *pDocShell->GetDoc(), nTextMarkupType, bAutomatic ); }