It's a very simple ODT file created with LibreOffice, and that I can open with the same version of LibreOffice [1]. $ cat test.js #!/usr/bin/gjs const Gtk = imports.gi.Gtk; const LOKDocView = imports.gi.LOKDocView; function open_document_cb(res, doc) { print ("open document cb got called"); } Gtk.init(null); let view = LOKDocView.View.new("/usr/lib64/libreoffice/program/", null, null); let location = "/home/hadess/Documents/Battery user testing.odt"; this.view.open_document(location, "", null, function() { print ("open document cb got called"); }); Gtk.main(); $ GI_TYPELIB_PATH=$GI_TYPELIB_PATH:/usr/lib64/libreoffice/girepository-1.0/ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64/libreoffice/program/ gjs test.js open document cb got called terminate called after throwing an instance of 'boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::property_tree::json_parser::json_parser_error> >' what(): <unspecified file>(1): expected value Application Error Make sure to change the path to the ODT file when testing it. [1]: From here: http://koji.fedoraproject.org/koji/buildinfo?buildID=703072
The "fix" is: -this.view.open_document(location, "", null, function() { +this.view.open_document(location, "{}", null, function() { The pRenderingArguments argument needs to be valid JSON. Still, it shouldn't crash, and consider either NULL, or "" as empty JSON.
NULL is already considered as empty JSON. "" is not, I'll fix that.
Miklos Vajna committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=5cc574fefc8a2ee39db4a4bd843a3ec67dce2f11 tdf#96250 desktop: empty str is the same as 0 str in jsonToPropertyValues() It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Miklos Vajna committed a patch related to this issue. It has been pushed to "libreoffice-5-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=e22f9ae034addbddbb5581cdee6bfd1c39aeedea&h=libreoffice-5-1 tdf#96250 desktop: empty str is the same as 0 str in jsonToPropertyValues() It will be available in 5.1.0.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
lok_doc_view_open_document still doesn't accept NULL as a valid value for pRenderingArguments, even if it is annotated as (nullable). The implementation needs a NULL check before: priv->m_aRenderingArguments = pRenderingArguments;
Miklos Vajna committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=032e34d0014d2154feaf97105d2dbe69b290b8c5 tdf#96250 LOK: guard against 0 pRenderingArguments It will be available in 5.2.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Works for me now, please speak up if it still does not. :-)
Miklos Vajna committed a patch related to this issue. It has been pushed to "libreoffice-5-1": http://cgit.freedesktop.org/libreoffice/core/commit/?id=e390b5f4f1267071245e452baa8dd63cdb556f1d&h=libreoffice-5-1 tdf#96250 LOK: guard against 0 pRenderingArguments It will be available in 5.1.0.2. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.