# HG changeset patch # User Edouard Tisserant # Date 1673882564 -3600 # Node ID da9ffd57255139c0b92da13d2069b441715b6a06 # Parent 3dafdb6ad02367fbc2b6c670da108e756d043a43 IDE: fix segfault when unselecting network discovery in URI editor diff -r 3dafdb6ad023 -r da9ffd572551 controls/DiscoveryPanel.py --- a/controls/DiscoveryPanel.py Sun Jan 15 21:40:58 2023 +0100 +++ b/controls/DiscoveryPanel.py Mon Jan 16 16:22:44 2023 +0100 @@ -129,10 +129,23 @@ self.IfacesMonitorTimer.Start(2000) self.Bind(wx.EVT_TIMER, self.IfacesMonitor, self.IfacesMonitorTimer) + def _cleanup(self): + if self.IfacesMonitorTimer is not None: + self.IfacesMonitorTimer.Stop() + self.IfacesMonitorTimer = None + if self.Browser is not None: + self.Browser.cancel() + self.Browser = None + if self.ZeroConfInstance is not None: + self.ZeroConfInstance.close() + self.ZeroConfInstance = None + def __del__(self): - self.IfacesMonitorTimer.Stop() - self.Browser.cancel() - self.ZeroConfInstance.close() + self._cleanup() + + def Destroy(self): + self._cleanup() + wx.Panel.Destroy(self) def IfacesMonitor(self, event): NewState = get_all_addresses(socket.AF_INET)