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

This commit is contained in:
blitzmann
2017-05-12 21:38:31 -04:00
parent 5392aaa27e
commit c68739d78c

View File

@@ -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)