Fix crash on closing item stats window when mutation's tab animation was in progress

This commit is contained in:
DarkPhoenix
2019-08-07 22:49:30 +03:00
parent 035c69c60a
commit fb93aa1ad5
4 changed files with 61 additions and 209 deletions

View File

@@ -129,12 +129,12 @@ class ItemStatsDialog(wx.Dialog):
self.SetSize(size)
self.parentWnd.RegisterStatsWindow(self)
self.Show()
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.Bind(wx.EVT_CHAR_HOOK, self.kbEvent)
self.Bind(wx.EVT_CLOSE, self.closeEvent)
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
self.Show()
def OnActivate(self, event):
self.parentWnd.SetActiveStatsWindow(self)
@@ -142,21 +142,18 @@ class ItemStatsDialog(wx.Dialog):
keycode = event.GetKeyCode()
mstate = wx.GetMouseState()
if keycode == wx.WXK_ESCAPE and mstate.GetModifiers() == wx.MOD_NONE:
self.closeWindow()
self.Close()
return
event.Skip()
def closeEvent(self, event):
self.container.onParentClose()
self.closeWindow()
event.Skip()
def closeWindow(self):
def OnClose(self, event):
self.container.OnWindowClose()
if self.dlgOrder == ItemStatsDialog.counter:
ItemStatsDialog.counter -= 1
self.parentWnd.UnregisterStatsWindow(self)
self.Destroy()
class ItemStatsContainer(wx.Panel):
def __init__(self, parent, stuff, item, context=None):
@@ -218,7 +215,7 @@ class ItemStatsContainer(wx.Panel):
if tab != -1:
self.nbContainer.SetSelection(tab)
def onParentClose(self):
def OnWindowClose(self):
mutaPanel = getattr(self, 'mutator', None)
if mutaPanel is not None:
mutaPanel.submitMutationChanges()
mutaPanel.OnWindowClose()