Steps to reproduce:
1. Open Writer.
2. In any document write anything, eg. "test" and select it.
3. Choose form the menu: Edit> Autotext..
4. Enter a name, eg. "test" for a new autotext entry and a shortcut. You may leave the automatic shortcut which was generated ("t") as is.
5. Press Autotext button on the right and select "New (text only)". This is essential, because the crash won't happen if you choose "New" option.
6. A new autotext entry will show up in "My Autotext" category. Select it.
7. Press the Autotext button again and choose "Change name"
8. A new window will show up. In the two lower boxes write the name to which you want to change the name of the new entry. The crash will happen immediately after you hit "OK" if and only if the new shortcut will be identical (case insensitive) with the old one.
Ps.: I'm using polish locale, so i'm not sure about the exact menu item's names in english. I guess you'll figure it out.
I was trying to change the name of autotext entry to other name but with the same shortcut. Writer immediately crashed with a message: "terminate called after throwing an instance of 'com::sun::star::container::ElementExistException'".
It should be allowed to change the name of an autotext entry w/o changing it's shortcut.
Platform (if different from the browser):
Browser: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Did this bug also happen with previous versions of LibreOffice?
Also: You state 3.4.4 as the affected version bug in launchpad 3.5.0-1ubuntu4/precise is reported.
Actually, when I reported this bug on Launchpad i meant Ubuntu 11.10. See:
Libreoffce version in 11.10 is 3.4.4 and is affected.
My description was replaced by the current one by penalvh. He states that it affects also 3.5.0-1ubuntu4.
Now I'm writing from my laptop with Ubuntu 11.04 installed where Libreoffice version is 3.3.4-0ubuntu1. It is also affected.
Created attachment 58098 [details]
No longer crashes when renaming AutoTexts.
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.
CaolÃ¡n McNamara committed a patch related to this issue.
It has been pushed to "master":
Resolves: fdo#46939 don't rename autotext when source and dest are the same
applied your patch, and moved the offending code inside "newname != oldname" conditional