]> git.lyx.org Git - lyx.git/commitdiff
Avoid crash when InsetBibitem::updateCommand shows a dialog 2.4.1
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 2 Jul 2024 12:49:34 +0000 (14:49 +0200)
committerRichard Kimberly Heck <rikiheck@lyx.org>
Tue, 2 Jul 2024 19:15:34 +0000 (15:15 -0400)
This is one of the places where a dialog is shown (indicating that
some bibtems have been renamed) while the metrics are not up to date.
Then a draw operation can be triggered too early and a crash can ensue.

Use ad-hoc solution for this case and use Buffer::setBusy(). The
Alert::warning helper cannot really do that since it doe snot know the
current buffer.

(cherry picked from commit c84c59eaecf19b1eb8227f9aadc7f5be187b3856)

ANNOUNCE
src/insets/InsetBibitem.cpp

index 46e63fd8e9ffb8f1f1eeca56a45665a71c901a2d..cd49a9f1e2620f77a7be49eb892e43ec6c296877 100644 (file)
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -97,6 +97,8 @@ What's new
 
 - Fix crash when deleting rows or columns from table.
 
+- Avoid crash when InsetBibitem::updateCommand shows a dialog.
+
 - Set cursor font after pasting to PassThru (e.g., ERT) inset (bug 12592).
 
 - Do not ask about unapplied changes if dialog has been closed.
index 6336da32d40b620acc029bb1d822dc90ae07df48..e08a57917384420bcd35834849a445a25a1dafae 100644 (file)
@@ -95,9 +95,11 @@ void InsetBibitem::updateCommand(docstring const & new_key, bool)
                        ++i;
                        key = new_key + '-' + convert<docstring>(i);
                }
+               buffer().setBusy(true);
                frontend::Alert::warning(_("Keys must be unique!"),
                        bformat(_("The key %1$s already exists,\n"
                        "it will be changed to %2$s."), new_key, key));
+               buffer().setBusy(false);
        }
        setParam("key", key);
        buffer().invalidateBibinfoCache();