Bug 123470

Summary: [ally] Libreoffice writer. Problems "save as" or "save a copy" when using text box
Product: LibreOffice Reporter: mirohe <miguelrodriguezhernando>
Component: WriterAssignee: Caolán McNamara <caolan.mcnamara>
Status: VERIFIED FIXED    
Severity: normal CC: buzea.bogdan, caolan.mcnamara, dgp-mail, raal
Priority: medium    
Version: 6.0.7.3 release   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=137571
Whiteboard: target:6.3.0 target:6.2.3
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 122043    
Attachments: this would work

Description mirohe 2019-02-14 17:55:25 UTC
Description:
Hi all.

detected in libreoffice 5.1.6.2 and 6.0.7.3 over Ubuntu 16.04 and ubuntu 18.04
I think it's in all the intermediate versions too.

if I open an empty document and insert text box and write in the word for example "foo" and then do a "save as" at file1.odt

Then without closing the document I add another word for example "bar" leaving the line as "foo bar" and make a "save as" at file2.odt, both file1.odt and file2.odt have the same content ¿¿why??.  
That is to say if I close the libreoffice and now I open file1.odt and file2.odt both have the content "foo", when the file2.odt would have to have the content "foo bar"

this also happens using the option to save a copy

Here he told them a video describing the problem graphically

https://youtu.be/h8c75ZZHPdo


Steps to Reproduce:
1.open document empty, insert text box an write a word and save as file1.odt
2.add new word in de same document an save as file2.odt
3.both document have te same content like file1.odt. hat is to say file1 == file2

Actual Results:
file1 and file2 same content

Expected Results:
file1 and file2 should have different results


Reproducible: Always


User Profile Reset: No



Additional Info:
Comment 1 Dieter 2019-02-14 19:37:50 UTC
Very strange, but I can't confirm it with

Version: 5.4.7.2 (x64)
Build-ID: c838ef25c16710f8838b1faec480ebba495259d0
CPU-Threads: 4; BS: Windows 6.19; UI-Render: GL; 
Gebietsschema: de-DE (de_DE); Calc: CL

or

Version: 6.1.5.2 (x64)
Build-ID: 90f8dcf33c87b3705e78202e3df5142b201bd805
CPU-Threads: 4; BS: Windows 10.0; UI-Render: Standard; 
Gebietsschema: de-DE (de_DE); Calc: group threaded
Comment 2 raal 2019-02-15 16:39:15 UTC
I can confirm with Version: 6.3.0.0.alpha0+
Build ID: c7ad7849d54fd3dad67e7779102f65b8b2f04881
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 

it works in x11 -> GTK3 issue. Adding to cc Caolán McNamara
Comment 3 Caolán McNamara 2019-02-27 14:26:47 UTC
looks like an a11y lifetime related bug forcing the first editeng to live long past what it should, so a SwXShape get reused again rather than created anew
Comment 4 Caolán McNamara 2019-02-27 16:12:22 UTC
Created attachment 149634 [details]
this would work

Looks like a SwXShape is created for the object when the box is created. If there is no a11y, then that SwXShape is no longer needed and is discarded. Each time we save then a new SwXShape is created and discarded.

If a11y is active, the SwXShape sticks around, so no new one is needed to be created, just the existing one reused.

But the SwXShape is created without a view so the sort of "snapshot" mode of SvxTextEditSourceImpl is in action where the text that exists the first time the text is queryed sticks as the result.
Comment 5 Caolán McNamara 2019-02-27 17:35:43 UTC
https://gerrit.libreoffice.org/68457 is my effort for this
Comment 6 Commit Notification 2019-02-27 21:22:45 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/f331244337a9b2c70ac1bb52b0637c32956b7d91%5E%21

tdf#123470 textforwarder has stale view of SdrTextObj

It will be available in 6.3.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 7 Caolán McNamara 2019-02-27 21:25:57 UTC
This is an a11y problem more obvious under gtk3 where a11y works. Should work not in master, and a backport to 6-2 is in gerrit
Comment 8 BogdanB 2019-03-04 08:52:09 UTC
Fixed. Verified on
Version: 6.3.0.0.alpha0+
Build ID: d4e3b48ee4c32bdb4e6cc37fb618cf818e152c31
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-03-02_23:38:22
Locale: ro-RO (ro_RO.UTF-8); UI-Language: en-US
Calc: threaded
Comment 9 Commit Notification 2019-03-06 10:36:04 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/6f90915f039ebd8f931cb16239756236bdae8a01%5E%21

tdf#123470 textforwarder has stale view of SdrTextObj

It will be available in 6.2.3.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.