[LyX/master] Fix crash when calling dialog-show with bogus names (#12873).

Pavel Sanda sanda at lyx.org
Mon Aug 14 20:42:19 UTC 2023


commit 59360761813470e4aa939e960023664ac452aa7f
Author: Pavel Sanda <sanda at lyx.org>
Date:   Mon Aug 14 23:54:47 2023 +0200

    Fix crash when calling dialog-show with bogus names (#12873).
---
 src/frontends/qt/GuiView.cpp |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/src/frontends/qt/GuiView.cpp b/src/frontends/qt/GuiView.cpp
index 764921c..ddf7e8d 100644
--- a/src/frontends/qt/GuiView.cpp
+++ b/src/frontends/qt/GuiView.cpp
@@ -5310,14 +5310,17 @@ Dialog * GuiView::findOrBuild(string const & name, bool hide_it)
 		return dialog;
 
 	dialog = build(name);
-	d.dialogs_[name].reset(dialog);
-	// Force a uniform style for group boxes
-	// On Mac non-flat works better, on Linux flat is standard
-	flatGroupBoxes(dialog->asQWidget(), guiApp->platformName() != "cocoa");
-	if (lyxrc.allow_geometry_session)
-		dialog->restoreSession();
-	if (hide_it)
-		dialog->hideView();
+	if (dialog) {
+
+		d.dialogs_[name].reset(dialog);
+		// Force a uniform style for group boxes
+		// On Mac non-flat works better, on Linux flat is standard
+		flatGroupBoxes(dialog->asQWidget(), guiApp->platformName() != "cocoa");
+		if (lyxrc.allow_geometry_session)
+			dialog->restoreSession();
+		if (hide_it)
+			dialog->hideView();
+		}
 	return dialog;
 }
 


More information about the lyx-cvs mailing list