Issue 3001 - macro keybinding crashes writer beyond recovery
Summary: macro keybinding crashes writer beyond recovery
Status: CLOSED FIXED
Alias: None
Product: Writer
Classification: Application
Component: code (show other issues)
Version: 641
Hardware: Other Windows 2000
: P2 Trivial (vote)
Target Milestone: ---
Assignee: stephan.wunderlich
QA Contact: issues@sw
URL: http://www.darwinwars.com/lunatic/bug...
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-04 14:18 UTC by ingenstans
Modified: 2003-09-08 16:56 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description ingenstans 2002-02-04 14:18:15 UTC
I have written a little macro which will, about fifty per cent of the time, when used in a newly 
opened document, crash OO completely, sometimes so badly it must be renistalled. This wasn't 
what I was trying to do. 

Here is the macro:

Sub bigleft
Dim oDocument, oDesktop, 
oText, oVCursor, oCursor As Object
' the two following lines get the active 
document
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocument= 
oDesktop.getCurrentComponent()
oText = oDocument.Text
' after this, an obscure call 
gets the current cursor position
oVCursor = 
oDocument.currentcontroller.getViewCursor()
' but the move-by-word functions need an 
invisible cursor
oCursor =oText.createTextCursorByRange(oVCursor.getstart())
if 
oCursor.isStartofWord() 
then
	oCursor.gotoPreviousWord(FALSE)
	oCursor.gotoStartOfWord(FALSE)
	else
	oCursor.gotoStartOfWord(FALSE)
endif
' 
finally send the visible cursor where it should 
be
oVCursor.gotoRange(oCursor,FALSE)
End Sub

Bind this to ctrl-left arrow. Open a 
document -- the one that most recenlty crashed on me is in the url -- go to somewhere in the middle. Press 
and hold ctrl-left and see what happens.

After the first crash, the program will exit every 
time I try to access the configuration dialogue so I can't even change the keybinding away from 
the one that causes trouble. Only a complete reinstall seems to fix it.

There must be some 
error in the macro, though I can't see what. But even if there is, such a mistake should never crash 
the whole program and then make it impossible to repair. So I think this is a very serious bug.
Comment 1 ingenstans 2002-02-04 14:28:34 UTC
changed url to correct a typo: should 
be

http://www.darwinwars.com/lunatic/bugs/ctrl-left_crash.sxw
Comment 2 Joost Andrae 2002-02-05 11:12:28 UTC
Joost->Stephan: please have a look at it
Comment 3 stephan.wunderlich 2002-02-05 11:31:59 UTC
Your macro works for me, which version of OpenOffice do you use ?

BTW: your macro moves the cursor to the start of the previous word.
AFAIK this behaviour is bound by default to the 'CTRL-LEFT' button.
Comment 4 ingenstans 2002-02-05 13:47:54 UTC
Works for me is not a sufficient resolution of this bug. I am using 641C and it 
definitely doesn't work here. If it works with 641b, fine: then it's a different sort 
of bug. I don't have that around to test. 

Nor does it hapen every time I use the 
macro. It only appears in certain documents. Did you test it on the one I posted a link 
to? What happened was that I wrote the macro, tested it and bound it to a key; all 
without trouble. But when I reopened OO and tried with another document (the one I 
have enclosed) it blew up as described. It had earlier done so on another document, 
but by the time I had uninstalled and reinstalled everything, I couldn't remember 
which one. 

By the way, the macro does not mimic the default ctrl-left behaviour in 
an important respect: that's why I wrote it. The default behaviour counts spaces as 
words, so that it moves to the beginning of the word you are in, then the _end_ of the 
preceding word, and then the beginning of the one before. I had put in an enhancement 
request about that, and wrote the macro as a fill-in while waiting to see what would 
happen. 
Comment 5 stephan.wunderlich 2002-02-05 15:44:10 UTC
The current Openoffice version seem to have a problem with writing the
configuration in 'soffice.cfg'. The described behaviour is independent
from the macro. 

Even an easy macro like 

sub sayHello
 print "hello"
end sub

bound to a key raises the same problem.

Since the behaviour doesn't appear in the current inhouse version
anymore I suppose it'll be fixed in the next OpenOffice build. 
Comment 6 ingenstans 2002-02-05 20:33:51 UTC
Folowing this hint, I went to the soffice.cfg sudirectory and deleted 
writerkeybindings.xml.

on restart, I was able to reconfigure the keys 
without, so far, causing any crashes. But I shall keep a backup of that file somewhere 
safe, in case it happens again
Comment 7 ingenstans 2002-02-07 13:41:59 UTC
yes. It happened again.
Any macro bound to any key seems able to produce this error
Comment 8 stephan.wunderlich 2003-09-05 13:18:59 UTC
SW: works in OOo1.1RC3 => closed