fix for gc errors on shutdown python3
authorGP Orcullo <kinsamanka@gmail.com>
Fri, 28 Oct 2022 19:39:17 +0800
branchpython3
changeset 3765 88fe6fc9fd38
parent 3764 d92c1a3dafa7
child 3766 f99def63cdd8
fix for gc errors on shutdown
IDEFrame.py
ProjectController.py
controls/DebugVariablePanel/DebugVariableGraphicViewer.py
controls/DebugVariablePanel/DebugVariableItem.py
controls/DebugVariablePanel/DebugVariablePanel.py
controls/DebugVariablePanel/DebugVariableTextViewer.py
controls/DebugVariablePanel/DebugVariableViewer.py
controls/DebugVariablePanel/GraphButton.py
controls/DurationCellEditor.py
controls/LibraryPanel.py
controls/LocationCellEditor.py
controls/LogViewer.py
controls/PouInstanceVariablesPanel.py
controls/VariablePanel.py
dialogs/BlockPreviewDialog.py
editors/ConfTreeNodeEditor.py
editors/DataTypeEditor.py
editors/DebugViewer.py
editors/FileManagementPanel.py
editors/IECCodeViewer.py
editors/ResourceEditor.py
editors/TextViewer.py
editors/Viewer.py
graphics/GraphicCommons.py
graphics/ToolTipProducer.py
--- a/IDEFrame.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/IDEFrame.py	Fri Oct 28 19:39:17 2022 +0800
@@ -762,9 +762,6 @@
 
         wx.CallAfter(self.InitFindDialog)
 
-    def __del__(self):
-        self.FindDialog.Destroy()
-
     def InitFindDialog(self):
         self.FindDialog = FindInPouDialog(self)
         self.FindDialog.Hide()
--- a/ProjectController.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/ProjectController.py	Fri Oct 28 19:39:17 2022 +0800
@@ -280,9 +280,6 @@
         self.IECcodeDigest = None
         self.LastBuiltIECcodeDigest = None
 
-    def __del__(self):
-        self.KillDebugThread()
-
     def LoadLibraries(self):
         self.Libraries = []
         TypeStack = []
--- a/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DebugVariablePanel/DebugVariableGraphicViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -118,15 +118,6 @@
         self.ParentControl = parent
         self.ParentWindow = window
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to Debug Variable Graphic Viewer and Debug Variable
-        # Panel
-        self.ParentControl = None
-        self.ParentWindow = None
-
     def OnDragOver(self, x, y, d):
         """
         Function called when mouse is dragged over Drop Target
--- a/controls/DebugVariablePanel/DebugVariableItem.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DebugVariablePanel/DebugVariableItem.py	Fri Oct 28 19:39:17 2022 +0800
@@ -63,13 +63,6 @@
         # Get Variable data type
         self.RefreshVariableType()
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Reset reference to debug variable panel
-        self.Parent = None
-
     def SetVariable(self, variable):
         """
         Set path of variable
--- a/controls/DebugVariablePanel/DebugVariablePanel.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DebugVariablePanel/DebugVariablePanel.py	Fri Oct 28 19:39:17 2022 +0800
@@ -92,13 +92,6 @@
         wx.TextDropTarget.__init__(self)
         self.ParentWindow = window
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to Debug Variable Panel
-        self.ParentWindow = None
-
     def OnDragOver(self, x, y, d):
         """
         Function called when mouse is dragged over Drop Target
--- a/controls/DebugVariablePanel/DebugVariableTextViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DebugVariablePanel/DebugVariableTextViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -51,15 +51,6 @@
         self.ParentControl = parent
         self.ParentWindow = window
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to Debug Variable Text Viewer and Debug Variable
-        # Panel
-        self.ParentControl = None
-        self.ParentWindow = None
-
     def OnDragOver(self, x, y, d):
         """
         Function called when mouse is dragged over Drop Target
--- a/controls/DebugVariablePanel/DebugVariableViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DebugVariablePanel/DebugVariableViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -74,13 +74,6 @@
         self.Buttons = []
         self.InitHighlightPensBrushes()
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to Debug Variable Panel
-        self.ParentWindow = None
-
     def InitHighlightPensBrushes(self):
         """
         Init global pens and brushes
--- a/controls/DebugVariablePanel/GraphButton.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DebugVariablePanel/GraphButton.py	Fri Oct 28 19:39:17 2022 +0800
@@ -58,13 +58,6 @@
         # Save reference to callback function
         self.Callback = callback
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to callback function
-        self.callback = None
-
     def SetBitmap(self, bitmap):
         """
         Set bitmap to use for button
--- a/controls/DurationCellEditor.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/DurationCellEditor.py	Fri Oct 28 19:39:17 2022 +0800
@@ -108,9 +108,6 @@
         self.Table = table
         self.Colname = colname
 
-    def __del__(self):
-        self.CellControl = None
-
     def Create(self, parent, id, evt_handler):
         self.CellControl = DurationCellControl(parent)
         self.SetControl(self.CellControl)
--- a/controls/LibraryPanel.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/LibraryPanel.py	Fri Oct 28 19:39:17 2022 +0800
@@ -114,13 +114,6 @@
         # Variable storing functions and function blocks library to display
         self.BlockList = None
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to project controller
-        self.Controller = None
-
     def SetController(self, controller):
         """
         Set reference to project controller
--- a/controls/LocationCellEditor.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/LocationCellEditor.py	Fri Oct 28 19:39:17 2022 +0800
@@ -62,9 +62,6 @@
         self.Default = False
         self.VariableName = None
 
-    def __del__(self):
-        self.Controller = None
-
     def SetController(self, controller):
         self.Controller = controller
 
@@ -160,10 +157,6 @@
         self.Table = table
         self.Controller = controller
 
-    def __del__(self):
-        self.CellControl = None
-        self.Controller = None
-
     def Create(self, parent, id, evt_handler):
         self.CellControl = LocationCellControl(parent)
         self.SetControl(self.CellControl)
--- a/controls/LogViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/LogViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -191,9 +191,6 @@
         self.Shown = True
         self.Callback = callback
 
-    def __del__(self):
-        self.callback = None
-
     def GetSize(self):
         return self.Size
 
@@ -382,9 +379,6 @@
         self.MessageToolTipTimer = wx.Timer(self, -1)
         self.Bind(wx.EVT_TIMER, self.OnMessageToolTipTimer, self.MessageToolTipTimer)
 
-    def __del__(self):
-        self.ScrollTimer.Stop()
-
     def ResetLogMessages(self):
         self.ResetLogCounters()
         self.OldestMessages = []
--- a/controls/PouInstanceVariablesPanel.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/PouInstanceVariablesPanel.py	Fri Oct 28 19:39:17 2022 +0800
@@ -217,10 +217,6 @@
         self.FilterCaseSensitive = False
         self.FilterWholeWord = False
 
-
-    def __del__(self):
-        self.Controller = None
-
     def SetTreeImageList(self, tree_image_list):
         self.VariablesList.SetImageList(tree_image_list)
 
--- a/controls/VariablePanel.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/controls/VariablePanel.py	Fri Oct 28 19:39:17 2022 +0800
@@ -685,9 +685,6 @@
             else:
                 self.VariablesGrid.SetColSize(col, self.ColSettings["size"][col])
 
-    def __del__(self):
-        self.RefreshHighlightsTimer.Stop()
-
     def SetTagName(self, tagname):
         self.TagName = tagname
         self.BodyType = self.Controler.GetEditedElementBodyType(self.TagName)
--- a/dialogs/BlockPreviewDialog.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/dialogs/BlockPreviewDialog.py	Fri Oct 28 19:39:17 2022 +0800
@@ -87,13 +87,6 @@
         # List of variables defined in POU {var_name: (var_class, var_type),...}
         self.VariableList = {}
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Remove reference to project controller
-        self.Controller = None
-
     def _init_sizers(self,
                      main_rows, main_growable_row,
                      left_rows, left_growable_row,
--- a/editors/ConfTreeNodeEditor.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/ConfTreeNodeEditor.py	Fri Oct 28 19:39:17 2022 +0800
@@ -255,9 +255,6 @@
         else:
             self.SetIcon(GetBitmap("Extension"))
 
-    def __del__(self):
-        self.Controler.OnCloseEditor(self)
-
     def GetTagName(self):
         return self.Controler.CTNFullName()
 
--- a/editors/DataTypeEditor.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/DataTypeEditor.py	Fri Oct 28 19:39:17 2022 +0800
@@ -456,9 +456,6 @@
         self.RefreshHighlightsTimer = wx.Timer(self, -1)
         self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, self.RefreshHighlightsTimer)
 
-    def __del__(self):
-        self.RefreshHighlightsTimer.Stop()
-
     def GetBufferState(self):
         return self.Controler.GetBufferState()
 
--- a/editors/DebugViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/DebugViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -79,24 +79,6 @@
         # Set DataProducer and subscribe tick if needed
         self.SetDataProducer(producer)
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        # Unsubscribe all data consumers
-        self.UnsubscribeAllDataConsumers()
-
-        # Delete reference to DataProducer
-        self.DataProducer = None
-
-        # Stop last refresh timer
-        if self.LastRefreshTimer is not None:
-            self.LastRefreshTimer.cancel()
-
-        # Release Common debug lock if DebugViewer has acquired it
-        if self.HasAcquiredLock:
-            DEBUG_REFRESH_LOCK.release()
-
     def SetDataProducer(self, producer):
         """
         Set Data Producer
--- a/editors/FileManagementPanel.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/FileManagementPanel.py	Fri Oct 28 19:39:17 2022 +0800
@@ -114,9 +114,6 @@
 
         self.SetIcon(GetBitmap("FOLDER"))
 
-    def __del__(self):
-        self.Controler.OnCloseEditor(self)
-
     def GetTitle(self):
         return _(self.TagName)
 
--- a/editors/IECCodeViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/IECCodeViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -30,11 +30,6 @@
 
 class IECCodeViewer(TextViewer):
 
-    def __del__(self):
-        TextViewer.__del__(self)
-        if getattr(self, "_OnClose"):
-            self._OnClose(self)
-
     def Paste(self):
         if self.Controler is not None:
             TextViewer.Paste(self)
--- a/editors/ResourceEditor.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/ResourceEditor.py	Fri Oct 28 19:39:17 2022 +0800
@@ -391,9 +391,6 @@
 
         self.TasksGrid.SetFocus()
 
-    def __del__(self):
-        self.RefreshHighlightsTimer.Stop()
-
     def RefreshTypeList(self):
         self.TypeList = []
         blocktypes = self.Controler.GetBlockResource()
--- a/editors/TextViewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/TextViewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -163,9 +163,6 @@
         self.RefreshHighlightsTimer = wx.Timer(self, -1)
         self.Bind(wx.EVT_TIMER, self.OnRefreshHighlightsTimer, self.RefreshHighlightsTimer)
 
-    def __del__(self):
-        self.RefreshHighlightsTimer.Stop()
-
     def GetTitle(self):
         if self.Debug or self.TagName == "":
             if len(self.InstancePath) > 15:
--- a/editors/Viewer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/editors/Viewer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -745,13 +745,6 @@
         self.Editor.Bind(wx.EVT_SIZE, self.OnMoveWindow)
         self.Editor.Bind(wx.EVT_MOUSE_EVENTS, self.OnViewerMouseEvent)
 
-    # Destructor
-    def __del__(self):
-        DebugViewer.__del__(self)
-        self.Flush()
-        self.ResetView()
-        self.RefreshHighlightsTimer.Stop()
-
     def SetCurrentCursor(self, cursor):
         if self.Mode != MODE_MOTION:
             if self.CurrentCursor != cursor:
--- a/graphics/GraphicCommons.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/graphics/GraphicCommons.py	Fri Oct 28 19:39:17 2022 +0800
@@ -712,10 +712,6 @@
         self.RefreshWireExclusion()
         self.RefreshBoundingBox()
 
-    # Destructor
-    def __del__(self):
-        self.Elements = []
-
     def GetDefinition(self):
         blocks = []
         wires = []
--- a/graphics/ToolTipProducer.py	Fri Oct 28 18:59:04 2022 +0800
+++ b/graphics/ToolTipProducer.py	Fri Oct 28 19:39:17 2022 +0800
@@ -55,12 +55,6 @@
                          self.OnToolTipTimer,
                          self.ToolTipTimer)
 
-    def __del__(self):
-        """
-        Destructor
-        """
-        self.DestroyToolTip()
-
     def OnToolTipTimer(self, event):
         """
         Callback for Tool Tip firing timer Event