[prev in list] [next in list] [prev in thread] [next in thread]
List: lyx-cvs
Subject: [LyX/master] Prevent wrong reference to duplicated (but deleted) label
From: Juergen Spitzmueller <spitz () lyx ! org>
Date: 2020-03-29 15:28:23
Message-ID: 20200329152823.4499B280151 () lyx ! lyx ! org
[Download RAW message or body]
commit 1e34871d3865c711b2005be429d9290c5e7223ef
Author: Juergen Spitzmueller <spitz@lyx.org>
Date: Sun Mar 29 17:47:59 2020 +0200
Prevent wrong reference to duplicated (but deleted) label
Fixes #11803
---
src/insets/InsetLabel.cpp | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/insets/InsetLabel.cpp b/src/insets/InsetLabel.cpp
index d8009ad..30211b8 100644
--- a/src/insets/InsetLabel.cpp
+++ b/src/insets/InsetLabel.cpp
@@ -316,6 +316,20 @@ void InsetLabel::latex(otexstream & os, OutputParams const & runparams_in) const
{
OutputParams runparams = runparams_in;
docstring command = getCommand(runparams);
+ docstring const label = getParam("name");
+ if (buffer().params().output_changes
+ && buffer().activeLabel(label)
+ && buffer().insetLabel(label, true) != this) {
+ // this is a deleted label and we have a non-deleted with the same id
+ // rename it for output to prevent wrong references
+ docstring newlabel = label;
+ int i = 1;
+ while (buffer().insetLabel(newlabel)) {
+ newlabel = label + "-DELETED-" + convert<docstring>(i);
+ ++i;
+ }
+ command = subst(command, label, newlabel);
+ }
// In macros with moving arguments, such as \section,
// we store the label and output it after the macro (#2154)
if (runparams_in.postpone_fragile_stuff)
--
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic