Skip to content

Commit

Permalink
Fix for #539 (#1141)
Browse files Browse the repository at this point in the history
* ApplicationWindow isn't cleaning up StatusBarManager (#539)

- Streamline naming of destroy function of StatusBarManager Qt and wx implementation
- Add destroying of StatusBarManager when application is destroyed

* Rename references (#539 cont.)
  • Loading branch information
johannesloibl authored and corranwebster committed Jul 11, 2022
1 parent 33b1f48 commit 9dc851a
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions pyface/i_application_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def destroy(self):

if self.tool_bar_manager is not None:
self.tool_bar_manager.destroy()

if self.status_bar_manager is not None:
self.status_bar_manager.destroy()

for tool_bar_manager in self.tool_bar_managers:
tool_bar_manager.destroy()

Expand Down
2 changes: 1 addition & 1 deletion pyface/ui/qt4/action/status_bar_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def create_status_bar(self, parent):

return self.status_bar

def destroy_status_bar(self):
def destroy(self):
""" Destroys the status bar. """
if self.status_bar is not None:
self.status_bar.deleteLater()
Expand Down
2 changes: 1 addition & 1 deletion pyface/ui/qt4/application_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def _menu_bar_manager_updated(self, event):
def _status_bar_manager_updated(self, event):
if self.control is not None:
if event.old is not None:
event.old.destroy_status_bar()
event.old.destroy()
self._create_status_bar(self.control)

@observe("tool_bar_manager, tool_bar_managers.items")
Expand Down
2 changes: 1 addition & 1 deletion pyface/ui/wx/action/status_bar_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def create_status_bar(self, parent):

return self.status_bar

def remove_status_bar(self, parent):
def destroy(self, parent):
""" Removes a status bar. """

if self.status_bar is not None:
Expand Down
2 changes: 1 addition & 1 deletion pyface/ui/wx/application_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ def _status_bar_manager_changed(self, old, new):
if self.control is not None:
if old is not None:
self.control.SetStatusBar(None)
old.remove_status_bar(self.control)
old.destroy(self.control)
self._create_status_bar(self.control)

@observe("tool_bar_manager, tool_bar_managers.items")
Expand Down

0 comments on commit 9dc851a

Please sign in to comment.