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 <dezsisz...@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
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice