[LyX/master] Avoid crash when InsetBibitem::updateCommand shows a dialog
Jean-Marc Lasgouttes
lasgouttes at lyx.org
Tue Jul 2 12:54:28 UTC 2024
commit c84c59eaecf19b1eb8227f9aadc7f5be187b3856
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date: Tue Jul 2 14:49:34 2024 +0200
Avoid crash when InsetBibitem::updateCommand shows a dialog
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.
---
src/insets/InsetBibitem.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp
index 343770e14d..beb775bc14 100644
--- a/src/insets/InsetBibitem.cpp
+++ b/src/insets/InsetBibitem.cpp
@@ -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();
More information about the lyx-cvs
mailing list