Bug 111854 - Formula objects are permanently deleted when tracking changes
Summary: Formula objects are permanently deleted when tracking changes
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium major
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: dataLoss
: 128485 143230 (view as bug list)
Depends on:
Blocks: Track-Changes
  Show dependency treegraph
 
Reported: 2017-08-16 09:46 UTC by Frederic Parrenin
Modified: 2023-12-18 01:41 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file (9.96 KB, application/vnd.oasis.opendocument.text)
2017-08-31 15:58 UTC, Buovjaga
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Frederic Parrenin 2017-08-16 09:46:37 UTC
Steps to reproduce:
- open a new .odt document
- type 'nf' and then click F3 to insert a numbered formula
- go to Edit > Track Changes > Save
- now select the whole document with CTRL-A and deleted
=> the formula object still appears (BTW, there is no way to see the formula is deleted, it should be strike-through).
- now save the document
=> the formula object is replaced with a box with 'Object 2' written in red
- now select all and discard the change
=> the formula is lost, it does not come back
Comment 1 Buovjaga 2017-08-31 15:58:04 UTC
Created attachment 135909 [details]
Example file

nf did not work for me, so here is a test file.

Reproduced.

Arch Linux 64-bit, KDE Plasma 5
Version: 6.0.0.0.alpha0+
Build ID: 4082b5874adddedf8332fe977b6bb47b6949b302
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kde4; 
Locale: fi-FI (fi_FI.UTF-8); Calc: group
Built on August 31st 2017

Arch Linux 64-bit
LibreOffice 3.3.0 
OOO330m19 (Build:6)
tag libreoffice-3.3.0.4
Comment 2 QA Administrators 2018-09-01 02:41:14 UTC Comment hidden (obsolete)
Comment 3 Frederic Parrenin 2018-09-03 08:05:43 UTC
This bug is still present in 6.0.5.
Comment 4 Frederic Parrenin 2018-09-03 08:10:26 UTC
It also present in 6.1.1.1.
Comment 5 NISZ LibreOffice Team 2019-11-05 15:18:07 UTC
*** Bug 128485 has been marked as a duplicate of this bug. ***
Comment 6 Gabor Kelemen (allotropia) 2021-07-13 17:23:07 UTC
*** Bug 143230 has been marked as a duplicate of this bug. ***
Comment 7 Matt K 2023-12-17 02:29:58 UTC
(In reply to Buovjaga from comment #1)
> nf did not work for me, so here is a test file.

I'm able to repro with the test file, but how did you insert the Formula?  I tried Insert->Field->More Fields..., but it doesn't insert the same type of Formula as in the test file and doesn't repro.
Comment 8 Buovjaga 2023-12-17 07:59:45 UTC
(In reply to Matt K from comment #7)
> (In reply to Buovjaga from comment #1)
> > nf did not work for me, so here is a test file.
> 
> I'm able to repro with the test file, but how did you insert the Formula?  I
> tried Insert->Field->More Fields..., but it doesn't insert the same type of
> Formula as in the test file and doesn't repro.

Try Insert - OLE Object - Formula Object.

Still repro observations from comment 0 except now there is an indication the object was deleted.

Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: 60(Build:1)
CPU threads: 8; OS: Linux 6.6; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
7.6.4-1
Calc: threaded
Comment 9 Matt K 2023-12-18 01:41:11 UTC
I was able to prevent the original formula from being lost on save by doing the following comment in the code of SwRangeRedline::Hide:

//case 2: DelCopyOfSection(nMyPos); break;

But the code still inserts a new Formula object and marks it deleted, so it seems like the original code is doing a delete then insert but I didn't find where yet.

Points of interest in the code:
- I bibisected the code change for "Mark image as deleted in track changes" to d845b91bcc6eb885c55494d4d4fab4ec09577e1d
- embobj.dll!DocumentHolder::CloseDocument
- smlo.dll!SmDocShell::Save