[rkward] /: Do not crash when closing plugin dialog with active plot preview

Thomas Friedrichsmeier null at kde.org
Thu Apr 19 16:06:17 UTC 2018


Git commit 19b3f4e3e6bae65117a7fad08e409d05fe5bdd9a by Thomas Friedrichsmeier.
Committed on 19/04/2018 at 16:06.
Pushed by tfry into branch 'master'.

Do not crash when closing plugin dialog with active plot preview

M  +1    -0    ChangeLog
M  +3    -1    rkward/windows/rkwindowcatcher.cpp
M  +1    -0    rkward/windows/rkwindowcatcher.h

https://commits.kde.org/rkward/19b3f4e3e6bae65117a7fad08e409d05fe5bdd9a

diff --git a/ChangeLog b/ChangeLog
index 6a1b3b9f..07198e92 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
 --- Version 0.7.1 - UNRELEASED
 - Do not throw an error on objects that return non-numeric/non-scalar dim()
+- Fix a crash when closing a plugin dialog with an active plot preview
 
 --- Version 0.7.0b - Apr-16-2018
 - Fix failure to install translations
diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp
index 7e305d01..10afba5c 100644
--- a/rkward/windows/rkwindowcatcher.cpp
+++ b/rkward/windows/rkwindowcatcher.cpp
@@ -289,6 +289,7 @@ RKCaughtX11Window::RKCaughtX11Window (RKGraphicsDevice* rkward_device, int devic
 void RKCaughtX11Window::commonInit (int device_number) {
 	RK_TRACE (MISC);
 
+	in_destructor = false;
 	capture = 0;
 	embedded = 0;
 	embedding_complete = false;
@@ -356,6 +357,7 @@ RKCaughtX11Window::~RKCaughtX11Window () {
 	RK_ASSERT (device_windows.contains (device_number));
 	device_windows.remove (device_number);
 
+	in_destructor = true;
 	close (false);
 	if (embedded) RKWindowCatcher::instance ()->unregisterWatcher (embedded->winId ());
 	error_dialog->autoDeleteWhenDone ();
@@ -395,7 +397,7 @@ bool RKCaughtX11Window::close (bool also_delete) {
 	QString status = i18n ("Closing device (saving history)");
 	if (!close_attempted) {
 		RCommand* c = new RCommand ("dev.off (" + QString::number (device_number) + ')', RCommand::App, i18n ("Shutting down device number %1", device_number));
-		setStatusMessage (status, c);
+		if (!in_destructor) setStatusMessage (status, c);
 		RKGlobals::rInterface ()->issueCommand (c);
 		close_attempted = true;
 	} else {
diff --git a/rkward/windows/rkwindowcatcher.h b/rkward/windows/rkwindowcatcher.h
index 33534ebd..5bdf7554 100644
--- a/rkward/windows/rkwindowcatcher.h
+++ b/rkward/windows/rkwindowcatcher.h
@@ -180,6 +180,7 @@ private:
 	int device_number;
 	bool killed_in_r;
 	bool close_attempted;
+	bool in_destructor;
 	QWidget *xembed_container;
 	QScrollArea *scroll_widget;
 	RKProgressControl *error_dialog;



More information about the rkward-tracker mailing list