User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 Firefox/48.0 Build Identifier: 10m0(Build:2) Libreoffice will accept versions of gobject-introspection as far back as 1.32.0 when configuring. However, LibreOfficeKit uses the (nullable) annotation, which was added in the 1.42 cycle. So, if an older version is installed, then introspection data for these functions will be generated without (nullable) for these functions, without any obvious indication that something has gone wrong (aside from possibly generating a warning when g-ir-scanner is run). This leads to unexpected behavior. For instance, lok_doc_view_new() might be called with an empty pPath string, rather than a null string, and the function does not check for an empty string and treat it as equivalent to NULL. We could do one of the following: (1) replace (nullable) with (allow-none); the latter is supported by older versions of gobject-introspection and is equivalent to (nullable) for in parameters. (2) Require at least version 1.42.0 of gobject-introspection. (3) Ensure that these functions treat empty strings as equivalent to NULL. Reproducible: Always Steps to Reproduce: 1. Build LibreOffice on a GNOME 3.10-based system. 2. Install the resulting binaries/package. 3. Run a recent version of gnome-documents (or anything else that uses libreofficekit via gobject-introspection). Actual Results: Gnome-documents crashed, since lok_doc_view_new() does not expect to be passed an empty string. Expected Results: Gnome-documents does not crash. For SLE, I am patching to replace (nullable) with (allow-none), and gnome-documents starts normally. Reset User Profile?No
(In reply to Mike Gorse from comment #0) > User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:48.0) Gecko/20100101 > Firefox/48.0 > Build Identifier: 10m0(Build:2) > > Libreoffice will accept versions of gobject-introspection as far back as > 1.32.0 when configuring. However, LibreOfficeKit uses the (nullable) > annotation, which was added in the 1.42 cycle. So, if an older version is > installed, then introspection data for these functions will be generated > without (nullable) for these functions, without any obvious indication that > something has gone wrong (aside from possibly generating a warning when > g-ir-scanner is run). This leads to unexpected behavior. For instance, > lok_doc_view_new() might be called with an empty pPath string, rather than a > null string, and the function does not check for an empty string and treat > it as equivalent to NULL. We could do one of the following: > (1) replace (nullable) with (allow-none); the latter is supported by older > versions of gobject-introspection and is equivalent to (nullable) for in > parameters. allow-none is deprecated since 1.42; How about putting both allow-none and nullable together wherever required to keep the backward compatibility upto 1.32 and then we can remove (allow-none) when we bump the version in future. My quick tweaking session with .gir and .typelib files seems to suggest that this should fix the issue, so hopefully this should be sufficient to address the crash. However, if we face more problems other than this, I think better to just bump the GI version.
Pranav Kant committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=84bfe584e4bd03a7b6e2c1e68c65bf99ae83c839 tdf#102511: Add (allow-none) for backward GI compatibility It will be available in 5.3.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.
Unfortunately, the patch that was committed to fix this isn't quite right and doesn't really do anything. There should only be a : after the final annotation; the parser interprets everything after the : as documentation and ignores the allow-none annotation. The following appears in the gir, for instance: <parameter name="pPath" transfer-ownership="none"> <doc xml:space="preserve">(allow-none): LibreOffice install path. Pass null to set it to default path which in most cases would be $libdir/libreoffice/program</doc>
Created attachment 131855 [details] Patch.
Thanks for the patch. Indeed it looks correct, not sure how the wrong version got in even though I remember having verified the fix on my local. Would it be possible for you to push the patch to gerrit ? If not (assuming its your first patch), I can commit it for you against your name, in that case, you need to send your license statement to the mailing list as described here[1] [1] https://wiki.documentfoundation.org/Development/GetInvolved#Connect_to_our_communication_channels
Just pushed to gerrit.
Mike Gorse committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=2ba485158bfa089e931c0c3e29389fe64a42dd4d tdf#102511: Fix gobject-introspection annotation syntax It will be available in 5.4.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.