fix crash in wxpython caused by timer fired on GridWindow after it was destroyed
now the timer is stopped immediately after GridWindow is destroyed
@@ -25,10 +25,16 @@ class GridToolTips(object):
self._information_popup = HtmlPopupWindow(grid, (450, 300))
self._grid = grid
self._tooltip_timer = wx.Timer(grid.GetGridWindow())
+ grid.GetGridWindow().Bind(wx.EVT_WINDOW_DESTROY, self.OnGridDestroy)
grid.GetGridWindow().Bind(wx.EVT_MOTION, self.OnMouseMotion)
grid.GetGridWindow().Bind(wx.EVT_TIMER, self.OnShowToolTip)
grid.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnGridEditorHidden)
+ def OnGridDestroy(self, event):
+ print("destroy ", flush=True)
+ self._tooltip_timer.Stop()
+ event.Skip()
+
def OnMouseMotion(self, event):
self._hide_tooltip()
self._start_tooltip_timer()
