From c68739d78c872a04ca35c294d5e37f5009603cbc Mon Sep 17 00:00:00 2001 From: blitzmann Date: Fri, 12 May 2017 21:38:31 -0400 Subject: [PATCH] Move the FitRemoved event before the stage selected events. Otherwise, if the stage is selected first and the FitItem (self) is deleted before the FitRemoved is done, we get an error about how self is not valid anymore --- gui/shipBrowser.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index 60c03153c..95819a434 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -1813,6 +1813,10 @@ class FitItem(SFItem.SFBrowserItem): sFit.deleteFit(self.fitID) + # Notify other areas that a fit has been deleted + wx.PostEvent(self.mainFrame, FitRemoved(fitID=self.fitID)) + + # todo: would a simple RefreshList() work here instead of posting that a stage has been selected? if self.shipBrowser.GetActiveStage() == 5: if fit in self.shipBrowser.lastdata: # remove fit from import cache self.shipBrowser.lastdata.remove(fit) @@ -1822,8 +1826,6 @@ class FitItem(SFItem.SFBrowserItem): else: wx.PostEvent(self.shipBrowser, Stage3Selected(shipID=self.shipID)) - wx.PostEvent(self.mainFrame, FitRemoved(fitID=self.fitID)) - def MouseLeftUp(self, event): if self.dragging and self.dragged: self.OnMouseCaptureLost(event)