Blob Blame History Raw
From 6a6d7d86266c832e3c7df43976218ca2e220f501 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miro=20Hron=C4=8Dok?= <miro@hroncok.cz>
Date: Mon, 6 Jul 2015 13:53:05 +0200
Subject: [PATCH] Prevent PyDeadObjectError

On wxPython 3, PyDeadObjectError exception was risen
when Cura was started for the first time.

This ensures it won't happen.

Related bug: https://bugzilla.redhat.com/show_bug.cgi?id=1230281
---
 Cura/gui/app.py          | 3 +++
 Cura/gui/splashScreen.py | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/Cura/gui/app.py b/Cura/gui/app.py
index 38c79fe..ebbb1e5 100644
--- a/Cura/gui/app.py
+++ b/Cura/gui/app.py
@@ -134,6 +134,7 @@ def afterSplashCallback(self):
 			self.loadFiles = [exampleFile]
 			if self.splash is not None:
 				self.splash.Show(False)
+				self.splash = None
 			configWizard.ConfigWizard()
 
 		if profile.getPreference('check_for_updates') == 'True':
@@ -141,6 +142,7 @@ def afterSplashCallback(self):
 			if newVersion is not None:
 				if self.splash is not None:
 					self.splash.Show(False)
+					self.splash = None
 				if wx.MessageBox(_("A new version of Cura is available, would you like to download?"), _("New version available"), wx.YES_NO | wx.ICON_INFORMATION) == wx.YES:
 					webbrowser.open(newVersion)
 					return
@@ -149,6 +151,7 @@ def afterSplashCallback(self):
 		self.mainWindow = mainWindow.mainWindow()
 		if self.splash is not None:
 			self.splash.Show(False)
+			self.splash = None
 		self.SetTopWindow(self.mainWindow)
 		self.mainWindow.Show()
 		self.mainWindow.OnDropFiles(self.loadFiles)
diff --git a/Cura/gui/splashScreen.py b/Cura/gui/splashScreen.py
index e2a2613..06e2bd7 100644
--- a/Cura/gui/splashScreen.py
+++ b/Cura/gui/splashScreen.py
@@ -13,4 +13,5 @@ def __init__(self, callback):
 
 	def DoCallback(self):
 		self.callback()
-		self.Destroy()
+		if self:
+			self.Destroy()