Bug 32783 - LibreOffice crashes when Basic calls an insert object method
Summary: LibreOffice crashes when Basic calls an insert object method
Status: CLOSED WORKSFORME
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
3.3.2 release
Hardware: x86 (IA32) Linux (All)
: medium blocker
Assignee: Not Assigned
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-02 09:52 UTC by Dorange-Pattoret Didier
Modified: 2011-04-27 23:48 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
File with right work... (11.82 KB, application/vnd.oasis.opendocument.text)
2011-01-02 09:52 UTC, Dorange-Pattoret Didier
Details
test document to insert formula object by macro (9.66 KB, application/vnd.oasis.opendocument.text)
2011-03-07 08:31 UTC, Alex Thurgood
Details
stack trace on Mac OSX (66.79 KB, text/plain)
2011-03-07 08:32 UTC, Alex Thurgood
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dorange-Pattoret Didier 2011-01-02 09:52:30 UTC
Created attachment 41571 [details]
File with right work...

This bug comes with Mandriva 2010.2 or MacOSX and OOO330m18 Build 4 (LibreO RC2).

Install Dmaths : www.dmaths.org/addons/DmathsAddon.oxt

First formula  write 1/2 and then F10 (F8 Mac) or red M icon in the toolbar.
then write +1/3 and then F10 (F8 Mac) or red M icon in the toolbar.

Instead you get 1 over 2 + 1 over 3 and the right formula, it crashes.

Library Dmaths
Modul named module1
Line 1543 : Objets=oTextCursor2.createContentEnumeration("com.sun.star.text.TextContent")

This line works very fine since OOo2.4 ....
Comment 1 Cédric Bosdonnat 2011-01-03 08:35:04 UTC
(In reply to comment #0)
> Created an attachment (id=41571) [details]
> File with right work...
> 
> This bug comes with Mandriva 2010.2 or MacOSX and OOO330m18 Build 4 (LibreO
> RC2).
> 
> Install Dmaths : www.dmaths.org/addons/DmathsAddon.oxt
> 
> First formula  write 1/2 and then F10 (F8 Mac) or red M icon in the toolbar.
> then write +1/3 and then F10 (F8 Mac) or red M icon in the toolbar.
> 
> Instead you get 1 over 2 + 1 over 3 and the right formula, it crashes.
> 
> Library Dmaths
> Modul named module1
> Line 1543 :
> Objets=oTextCursor2.createContentEnumeration("com.sun.star.text.TextContent")
> 
> This line works very fine since OOo2.4 ....

I can't reproduce the crash... neither on 3.3 nor master branch. Could you please extract some minimal basic macro showing the bug?

It would be helpful for you to provide some more infos, see
http://wiki.documentfoundation.org/BugReport
Comment 2 Alex Thurgood 2011-03-07 08:30:47 UTC
Hi all,

Confirming reproducible crash on Mac OSX 10.6.6 with LibO 3.3.1 and using the following Sub routine provided by Didier Dorange :

/Sub bugMac
    oViewCursor = ThisComponent.getCurrentController().getViewCursor()
    oTextCursor=oViewCursor.Text.createTextCursorByRange(oViewCursor)
    obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
    obj.CLSID="078B7ABA-54FC-457F-8551-6147e776a997"
    obj.AnchorType=com.sun.star.text.TextContentAnchorType.AS_CHARACTER
    oTextCursor.Text.insertTextContent(oTextCursor, obj, true)
    obj.embeddedObject.formula="1 over x"
    obj.dispose
End Sub/ 

Test document provided.


Alex
Comment 3 Alex Thurgood 2011-03-07 08:31:33 UTC
Created attachment 44198 [details]
test document to insert formula object by macro

test document to insert formula object by macro
Comment 4 Alex Thurgood 2011-03-07 08:32:24 UTC
Created attachment 44199 [details]
stack trace on Mac OSX

trace report provided by Apple Crash reporter
Comment 5 Alex Thurgood 2011-03-07 08:33:09 UTC
changing title to better reflect behaviour
Comment 6 Alex Thurgood 2011-03-07 08:37:58 UTC
removing needinfo keyword
Comment 7 Alex Thurgood 2011-03-07 08:38:35 UTC
changing platform to OSX
Comment 8 Dorange-Pattoret Didier 2011-03-07 09:51:25 UTC
1) If I comment the following line :  obj.dispose, the formula is inserted.
2) But, If I try to remove it (with "Backspace") LibreOffice crashes again.
3) If I copy and paste the formula, I can remove the pasted one but not the first.

May be a problem with memory when I try to destroy the object ?
Comment 9 phil pham 2011-03-26 07:20:36 UTC
Same bug with debian squeeze + LibO 3.3.2 OOO330m19 (Build:202-202-8) + dmaths 3.4.0.0
Comment 10 charly_salmon 2011-03-26 12:22:40 UTC
Same bug with Ubuntu 10.10 + LibO 3.3.2 OOO330m19 (Build:202-202-8) + dmaths
3.4.0.4
Dmaths is for me essemtial. I choose to use OOo3.2.1 back
Comment 11 Andreas Becker 2011-04-24 03:20:26 UTC
In LibreOffice 3.4.0 DEV300m103, the application does not crash.

When obj.dispose is called, 

Error: File /home/abecker/libreoffice/bootstrap/comphelper/source/container/embeddedobjectcontainer.cxx, Line 1156: Failed to remove object from storage!

appears in the terminal. It seems like someone added a try-catch block.
I found out that the function FSStorage::removeElement throws an io::IOException() exception.
Comment 12 Dorange-Pattoret Didier 2011-04-24 05:10:28 UTC
Hello,

I think you can close this bug because the problem comes with the embeddedobject property wich has been changed. The below code works fine with Libreoffice 3.3 and 3.4


I wrote obj.model.formula instead of obj.embeddedObject.formula

Best regards.

/Sub bugMac
    oViewCursor = ThisComponent.getCurrentController().getViewCursor()
    oTextCursor=oViewCursor.Text.createTextCursorByRange(oViewCursor)
    obj=ThisComponent.CreateInstance("com.sun.star.text.TextEmbeddedObject")
    obj.CLSID="078B7ABA-54FC-457F-8551-6147e776a997"
    obj.AnchorType=com.sun.star.text.TextContentAnchorType.AS_CHARACTER
    oTextCursor.Text.insertTextContent(oTextCursor, obj, true)
    obj.model.formula="1 over x"
    obj.dispose
End Sub/
Comment 13 Rainer Bielefeld Retired 2011-04-26 01:15:04 UTC
(In reply to comment #12)
Closing due to comment
Comment 14 Jean-Baptiste Faure 2011-04-27 23:48:26 UTC
closing.