[education/rkward] /: Fix crash in corner case of inline progress control

Thomas Friedrichsmeier null at kde.org
Fri May 6 17:08:33 BST 2022


Git commit 975fd2271c87d77a95ddf04a922d51a2803aa652 by Thomas Friedrichsmeier.
Committed on 06/05/2022 at 16:08.
Pushed by tfry into branch 'master'.

Fix crash in corner case of inline progress control

M  +0    -1    ChangeLog
M  +5    -0    rkward/misc/rkprogresscontrol.cpp

https://invent.kde.org/education/rkward/commit/975fd2271c87d77a95ddf04a922d51a2803aa652

diff --git a/ChangeLog b/ChangeLog
index db817b5e..91a9f838 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,7 +10,6 @@ TODOs:
 - Better placement of messages in non-plot preview windows
 - Fixed some problems with cancelling running commands
 - Package installation uses inline widget to provide progress feedback, instead of separate dialogs
-	- TODO: Fix crash, if cancelling of operation is confirmed, after operation has finished (guard against deletion, while question sub-dialog is active)
 - Package installation no longer uses an external process, unless required for root permissions
 - Fixed: Package installation as root would fail to find kdesu/kdesudo on recent systems
 - Fixed: R help pages would refuse to open in new tab
diff --git a/rkward/misc/rkprogresscontrol.cpp b/rkward/misc/rkprogresscontrol.cpp
index c7592f43..f95322cd 100644
--- a/rkward/misc/rkprogresscontrol.cpp
+++ b/rkward/misc/rkprogresscontrol.cpp
@@ -515,7 +515,12 @@ bool RKInlineProgressControl::eventFilter(QObject *, QEvent *e) {
 	}
 	if ((e->type() == QEvent::Close) && !is_done) {
 		if (allow_cancel) {
+			bool autoclose_save = autoclose;  // must prevent self-destruction while dialog below is active (the operation might complete, while it exec's)
+			autoclose = false;
+
 			bool ignore = (KMessageBox::warningContinueCancel(display_area, i18n("Closing this window will cancel the current operation. Are you sure?"), i18n("Cancel operation"), KGuiItem(i18n("Keep waiting")), KGuiItem(i18n("Cancel && Close"))) == KMessageBox::Continue);
+
+			autoclose = autoclose_save;
 			if (ignore) {
 				e->accept();
 				return true;


More information about the rkward-tracker mailing list