diff options
author | Michael Stahl <mst@openoffice.org> | 2010-01-20 16:59:56 +0100 |
---|---|---|
committer | Michael Stahl <mst@openoffice.org> | 2010-01-20 16:59:56 +0100 |
commit | 85bd4fb7e1db9d02ab9801afcd7e45381ae6a787 (patch) | |
tree | 1c51500e854568890ebaf9e920f52875b2ff45f4 /sw | |
parent | c93ddde38115731d4e5ca2dd41f0dced93625cd7 (diff) |
swunolocking1: #i108489#: fix crash:
XTextRangeToSwPaM(): do not prematurely release newly created text cursor.
SwXTextViewCursor::gotoRange(): do not throw IllegalArgumentException.
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/unocore/unoobj2.cxx | 7 | ||||
-rw-r--r-- | sw/source/ui/uno/unotxvw.cxx | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 90d8c7538a0d..8f6c3c3340d1 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1160,10 +1160,11 @@ bool XTextRangeToSwPaM( SwUnoInternalPaM & rToFill, // if it's a text then create a temporary cursor there and re-use // the pCursor variable - if(pText) + // #i108489#: Reference in outside scope to keep cursor alive + uno::Reference< text::XTextCursor > xTextCursor; + if (pText) { - const uno::Reference< text::XTextCursor > xTextCursor = - pText->CreateCursor(); + xTextCursor.set( pText->CreateCursor() ); xTextCursor->gotoEnd(sal_True); const uno::Reference<lang::XUnoTunnel> xCrsrTunnel( xTextCursor, uno::UNO_QUERY); diff --git a/sw/source/ui/uno/unotxvw.cxx b/sw/source/ui/uno/unotxvw.cxx index c83db6909045..4ce45761485b 100644 --- a/sw/source/ui/uno/unotxvw.cxx +++ b/sw/source/ui/uno/unotxvw.cxx @@ -1364,7 +1364,9 @@ void SwXTextViewCursor::gotoRange( SwUnoInternalPaM rDestPam(*m_pView->GetDocShell()->GetDoc()); if (!::sw::XTextRangeToSwPaM(rDestPam, xRange)) - throw IllegalArgumentException(); + { + throw uno::RuntimeException(); + } ShellModes eSelMode = m_pView->GetShellMode(); SwWrtShell& rSh = m_pView->GetWrtShell(); |