Bug 145372 - Cross References to Figures (number range variables) do not update, if Frame containing image and Figure caption (number range variable) is deleted
Summary: Cross References to Figures (number range variables) do not update, if Frame ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
7.2.2.2 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Frame Fields-Cross-Reference
  Show dependency treegraph
 
Reported: 2021-10-29 05:45 UTC by an
Modified: 2023-07-17 12:05 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
test file for demonstrating problem (32.68 KB, application/vnd.oasis.opendocument.text)
2023-03-15 11:50 UTC, sdc.blanco
Details

Note You need to log in before you can comment on or make changes to this bug.
Description an 2021-10-29 05:45:16 UTC
Description:
When working with a document that contains cross-references to figure numbers, deleting the figures does not result in the references showing the "Error: Reference source not found" text. Instead, the field shows the old number. Using "Update Fields" or pressing F9 does not update them.

Steps to Reproduce:
1. Create a blank Writer document.
2. Insert 4 images.
3. Configure each image to be positioned as a character.
4. Add a caption to each image, which also adds a figure number field to each one.
5. At the top of the document use the Insert>Cross-reference tool to insert references to the figure numbers. This simple example just looks like "1 2 3 4" where each number is a field.
6. Pick an image at random and delete it. While the figure numbering for the remaining figures does update, the number for the one I deleted remains the same. So, if I delete figure 2 from the document, the cross references now look like "1 2 2 3". We *know* that the second reference is wrong, and clicking on it goes no where, but it is not updated to show the "Error: Reference source not found" message.
7. Clicking F9 or using the menu to "Update Fields" does not work. Saving the document and opening it again seems to update the fields. Sometimes clicking View>"Show Tracked Changes" is enough to update the missing field, but this doesn't always work.

Actual Results:
The field text for a deleted field target retains the old value.

Expected Results:
The field text for a deleted field target should always show the "Error: Reference source not found" message.


Reproducible: Always


User Profile Reset: No



Additional Info:
Please fix. This makes working on large documents with lots of cross references to figures particularly painful.
Comment 1 an 2021-10-29 05:46:56 UTC
To clarify, when I say "delete the image" I mean delete the frame that contains the image, the caption, and the field.
Comment 2 Dieter 2021-11-14 05:20:13 UTC
I confirm it with

Version: 7.2.3.1 (x64) / LibreOffice Community
Build ID: 1d5dee817bde88d78dbcc0d00f88492568e131d5
CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Additional observation:
Typing text into caption also changes cross-reference
Comment 3 sdc.blanco 2023-03-15 11:50:00 UTC
Created attachment 185975 [details]
test file for demonstrating problem

Repro with

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: ee5dbd193fa24b46fb980ddd8a6c39ca349d0d01
CPU threads: 8; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: da-DK (da_DK); UI: en-US
Calc: CL threaded

The problem in summary is:

1.  If a number range variable field is deleted, then a cross-reference variable to that field will show (as expected) "Error: Reference source not found".

2. If the number range variable field is INSIDE A FRAME, and the frame is deleted, then (unexpected) the cross-reference variable is not updated, when it is expected that it will show "Error: Reference source not found".

Attached document provides a simple test/illustration of this behavior.