Bug 123741 - Document broken after saving when created from template
Summary: Document broken after saving when created from template
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: iOS Editor (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: Other iOS
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:6.4.0
Keywords:
: 124898 (view as bug list)
Depends on:
Blocks:
 
Reported: 2019-02-27 14:02 UTC by Nicolas Christener
Modified: 2019-10-16 13:05 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Video showing the issue (1.08 MB, video/mp4)
2019-02-27 14:10 UTC, Nicolas Christener
Details
Buggy ODT (88.66 KB, application/vnd.oasis.opendocument.text)
2019-09-25 15:02 UTC, Aron Budea
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Christener 2019-02-27 14:02:36 UTC
Description:
Changing and saving the "pet" document in iOS leads to a "broken" document.

Steps to Reproduce:
1.) configure the iOS App to use templates from: https://nicu.winebarrel.ch/tpl/00_index.txt
2.) open Collabora Office Mobile
3.) create a new document and use "homework_my_pet" as the template
4.) edit the title "PERSÖNLICHKEIT" -> "PERSÖNLICHKEIT 2"
5.) click the "save" icon
6.) close the document using the "<" Button (top left corner)
7.) Open the document again

Actual Results:
The string "PERSÖNLICHKEIT 2" is not defined as "heading 1"-style anymore it seems like the column break is lost as well.

Expected Results:
The string "PERSÖNLICHKEIT 2" should still be a "heading 1", there should be a column break before the string "PERSÖNLICHKEIT 2"


Reproducible: Sometimes


User Profile Reset: No



Additional Info:
Comment 1 Nicolas Christener 2019-02-27 14:10:58 UTC
Created attachment 149631 [details]
Video showing the issue
Comment 2 How can I remove my account? 2019-09-24 13:20:19 UTC
Could be related to translated style names? I could reproduce, and when I checked the saved document in desktop LibreOffice, the edited heading had style "Heading 1" but the other headings had style "Überschrift 1". I had edited the document with the app in the Swiss German locale.
Comment 3 How can I remove my account? 2019-09-24 13:23:45 UTC
But if I do the creation of the document from the template in an English locale, the formatting does not break, and all the styles show up as "Heading 1" in the desktop LO.
Comment 4 Aron Budea 2019-09-25 15:02:11 UTC
Created attachment 154497 [details]
Buggy ODT

Attaching a buggy sample created with the steps. iPad language had to be switched to German first.
Comment 5 Nicolas Christener 2019-10-02 08:33:21 UTC
Still present in 4.1.63

Just mentioning it, because I thought it could be a dup of #125575 (#125575 is fixed in 4.1.63 - so this issue probably has a different root cause).
Comment 6 Nicolas Christener 2019-10-02 09:02:18 UTC
I think I found the pattern.

This bug only happens, if one does "create new from template" and "save the document" in the same "session".

To be very precise, some more comments:

The following always triggers the issue for me:
1a.) Configure the app to use the templates from 
     https://nicu.winebarrel.ch/tpl/00_index.txt
2a.) Open the iOS app
3a.) Use "Create from template" function to create a new document from
     the template
4a.) Chose "homework_my_pet"
5a.) edit the title "PERSÖNLICHKEIT" -> "PERSÖNLICHKEIT 2"
6a.) click the "save" icon
7a.) close the document using the "<" Button (top left corner)
8a.) Open the document again

The following workaround helps to *not* trigger the issue:
1b.) Configure the app to use the templates from
     https://nicu.winebarrel.ch/tpl/00_index.txt
2b.) Open the iOS app
3b.) Use "Create from template" function to create a new document from
     the template
4b.) Chose "homework_my_pet"
5b.) Now properly close the app through the iOS mechanism
6b.) Open the app again and open the file which was created in the
     previous "session"
7b.) Edit and save the file

This leads to my naive conclusion, that creating "from template" somehow screws up the "state" of the running app and a subsequent "save file"-call will result in a broken document.

Maybe a temporary solution could be to instantiate the file from the template and then instead of loading the new file directly, go back to the file browser and the user has to open the file manually. This way we would probably have the same effect as closing the app manually like in step "5b.)" (at least that's my naive understanding, sorry if this is wrong).
Comment 7 Andreas Gruhler 2019-10-07 12:07:06 UTC
*** Bug 124898 has been marked as a duplicate of this bug. ***
Comment 8 How can I remove my account? 2019-10-10 08:42:10 UTC
Going to look into this now.
Comment 9 Commit Notification 2019-10-10 16:47:47 UTC
Tor Lillqvist committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/online/commit/1cf3bec303bc8b3d10e5dd673731906d3704b7b3

tdf#123741: Call LibreOfficeKit::setLanguageTag() also when loading a template
Comment 10 How can I remove my account? 2019-10-10 17:01:43 UTC
The corresponding fix in the collabora-online-4 branch seems to have fixed the problem. Sadly I didn't achieve a full understanding of the mechanism that caused the problem before I came up with the fix. But clearly it is related to using two different settings for the LibreOfficeKit "language tag" during the lifetime of the same process, first without setting it explicitly when loading the template, then after setting it when loading the document that was saved from the template.
Comment 11 Nicolas Christener 2019-10-16 11:42:00 UTC
Fixed. I testes with 4.1.66 and I can't reproduce the issue anymore.

I think this issue can be closed.

Thanks a lot to the Collabora team and especially Tor for fixing this issue!