Browse Source

Fix error message has appeared after close any module dialog (#249)

Tomas Zigo 5 years ago
parent
commit
7282637d21
1 changed files with 8 additions and 2 deletions
  1. 8 2
      gui/wxpython/gui_core/forms.py

+ 8 - 2
gui/wxpython/gui_core/forms.py

@@ -918,11 +918,11 @@ class TaskFrame(wx.Frame):
                     # happens when closing dialog of a new layer which was
                     # removed from tree
                     pass
-                self.Destroy()
+                self._Destroy()
         else:
             Debug.msg(1, "TaskFrame.OnCancel(): no parent")
             # cancel for non-display commands
-            self.Destroy()
+            self._Destroy()
 
     def OnHelp(self, event):
         """Show manual page (switch to the 'Manual' notebook page)"""
@@ -938,6 +938,12 @@ class TaskFrame(wx.Frame):
         return self.notebookpanel.createCmd(ignoreErrors=ignoreErrors,
                                             ignoreRequired=ignoreRequired)
 
+    def _Destroy(self):
+        """Destroy Frame"""
+        self.notebookpanel.notebook.Unbind(wx.EVT_NOTEBOOK_PAGE_CHANGED)
+        self.notebookpanel.notebook.widget.Unbind(wx.EVT_NOTEBOOK_PAGE_CHANGED)
+        self.Destroy()
+
 
 class CmdPanel(wx.Panel):
     """A panel containing a notebook dividing in tabs the different