Skip to content

Commit

Permalink
Merge pull request #19085 from ccordoba12/issue-19084
Browse files Browse the repository at this point in the history
PR: Restore the previous way of closing all clients (IPython console)
  • Loading branch information
ccordoba12 authored Aug 17, 2022
2 parents 15e1e59 + 1b3be9f commit 3e37d40
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions spyder/plugins/ipythonconsole/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -1938,13 +1938,20 @@ def close_all_clients(self):
bool
If the closing action was succesful.
"""
while self.clients:
client = self.clients.pop()
is_last_client = len(self.get_related_clients(client)) == 0
# IMPORTANT: **Do not** change this way of closing clients, which uses
# a copy of `self.clients`, because it preserves the main window layout
# when Spyder is closed.
# Fixes spyder-ide/spyder#19084
open_clients = self.clients.copy()
for client in self.clients:
is_last_client = (
len(self.get_related_clients(client, open_clients)) == 0)
client.close_client(is_last_client)
open_clients.remove(client)

# Close all closing shellwidgets.
ShellWidget.wait_all_shutdown()

# Close cached kernel
self.close_cached_kernel()
self.filenames = []
Expand Down

0 comments on commit 3e37d40

Please sign in to comment.