Date: prev next · Thread: first prev next last
2012 Archives by date, by thread · List index



Hi!

So... after a long debugging session, I managed to trace the crash all the way
from glossary.cxx through
gloshdl.cxx->swblock.cxx->shellio.cxx->SwXMLTextBlocks.cxx to storage.cxx.

First of all, the crash only happens when I rename an AutoText but set the
shortcut to something already existing.

storage.cxx:3282 here's where the exception throw happens. Although don't know
why. Someone already was thinking about this very same question, hence the
question marks in the comments at the end of the line :)
This thrown exception is caught a few lines later only to create a log entry,
and to be rethrown. And this rethrown exception is not handled. -> that is our
problem.

So I added a try catch block in the nearest place (not in xstorage.cxx because
someone might want to catch that rethrown exception elsewhere).
And that nearest place is: SwXMLTextBlocks.cxx:218
xRoot->renameElement ( aOldStreamName, aNewStreamName );

It can be seen a few lines later, that xBlkRoot is handled the same way,
catching a container::ElementExistException, but doing nothing in the catch
block.

I tested it, it worked for me. At least I think it's working, if you spot any
errors, just let me know.

https://bugs.freedesktop.org/show_bug.cgi?id=46939

Szabolcs                                          
From d01dbb62419fdeed2aae107512e4bcd3f6660c09 Mon Sep 17 00:00:00 2001
From: Szabolcs Dezsi <dezsiszabi@hotmail.com>
Date: Wed, 7 Mar 2012 04:15:30 +0100
Subject: [PATCH] Fixed crash when renaming AutoText

---
 sw/source/core/swg/SwXMLTextBlocks.cxx |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 5a19bc6..f51b019 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -215,7 +215,10 @@ sal_uLong SwXMLTextBlocks::Rename( sal_uInt16 nIdx, const String& rNewShort, 
con
         String aNewStreamName( aPackageName ); aNewStreamName += sExt;
 
         xRoot = xBlkRoot->openStorageElement( aOldName, embed::ElementModes::READWRITE );
-        xRoot->renameElement ( aOldStreamName, aNewStreamName );
+        try {
+            xRoot->renameElement ( aOldStreamName, aNewStreamName );
+        }
+        catch( const container::ElementExistException& ){}
         uno::Reference < embed::XTransactedObject > xTrans( xRoot, uno::UNO_QUERY );
         if ( xTrans.is() )
             xTrans->commit();
-- 
1.7.7


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.