LibreOffice crash
Piet van Oostrum
piet at vanoostrum.org
Tue Mar 31 07:36:37 PDT 2015
Michael Stahl wrote:
> On 28.03.2015 21:52, Piet van Oostrum wrote:
> > > Now when I do this with a Writer document:
> > >
> > > textdoc = smgr.createInstanceWithContext("com.sun.star.text.TextDocument", context)
> > >
> > > LibreOffice crashes with a segmentation fault.
>
> this is not a supported way to create a document: it will only create
> the document model but no view or controller for it. there is probably
> some bug where a pointer is null and dereferenced, but if it didn't
> crash it still wouldn't work because some APIs require that there is a view.
>
Well, I found this procedure in https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Handling_Documents
It says:
Such empty documents also can created without a frame:
create the document by instantiating it with its UNO service name
get the com.sun.star.frame.XLoadable interface from the document
call its initNew() method.
It works for Spreadsheet, just not for TextDocument. But I did see several pieces of code on the internet that use it also for TexDocument. These are old, so it might have worked in the past.
--
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
More information about the LibreOffice
mailing list