[education/rkward] /: Fix crash when switching from dialog to wizard with nested components and preview

Thomas Friedrichsmeier null at kde.org
Mon Jun 9 09:36:08 BST 2025


Git commit 6d48c00e07f6e316f5265bb0be4a5d8347a2b824 by Thomas Friedrichsmeier.
Committed on 09/06/2025 at 08:35.
Pushed by tfry into branch 'master'.

Fix crash when switching from dialog to wizard with nested components and preview

BUG: 505364

M  +1    -0    ChangeLog
M  +3    -5    rkward/plugin/rkstandardcomponent.cpp

https://invent.kde.org/education/rkward/-/commit/6d48c00e07f6e316f5265bb0be4a5d8347a2b824

diff --git a/ChangeLog b/ChangeLog
index 0958fb1d3..153a786aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,5 @@
 --- Version 0.8.2 - UNRELEASED
+- Fixed: Crash when switch from dialog to wizard interface in plugins providing a preview   - TODO: add autotest
 - Added: Actions to navigate R code based on its structure & Quick Code Navigation Mode
 - Added: Plugins: Enhance addChangeCommand() to allow writing more readable GUI logic code
 - Added: Plugins: Simplify running R commands inside GUI logic code
diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp
index 72e8e54d9..3ad875ffd 100644
--- a/rkward/plugin/rkstandardcomponent.cpp
+++ b/rkward/plugin/rkstandardcomponent.cpp
@@ -647,11 +647,9 @@ void RKComponentBuilder::buildElement(const QDomElement &element, XMLHelper &xml
 			widget = new RKText(e, component(), parent_widget);
 		} else if (e.tagName() == QLatin1String("preview")) {
 			QWidget *pwidget = parent_widget;
-			if (!parent->isWizardish()) {
-				RKStandardComponent *uicomp = parent->topmostStandardComponent();
-				if (uicomp) {
-					parent_widget = static_cast<RKStandardComponent *>(uicomp)->gui->custom_preview_buttons_area;
-				}
+			RKStandardComponent *uicomp = parent->topmostStandardComponent();
+			if (uicomp && !uicomp->isWizardish()) {
+				parent_widget = static_cast<RKStandardComponent *>(uicomp)->gui->custom_preview_buttons_area;
 			}
 			widget = new RKPreviewBox(e, component(), parent_widget);
 			parent_widget->layout()->addWidget(widget);


More information about the rkward-tracker mailing list