Skip to content

Commit 022effe

Browse files
committed
Prevent multiple on exit prompts on gnome
1 parent fe64646 commit 022effe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

studio/main.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ def __init__(self, master=None, **cnf):
211211
self._startup()
212212
self._restore_position()
213213
self._exit_failures = 0
214+
self._is_shutting_down = False
214215

215216
def _startup(self):
216217
on_startup = pref.get("studio::on_startup")
@@ -590,15 +591,21 @@ def _force_exit_prompt(self):
590591

591592
def _on_close(self):
592593
""" Return ``True`` if exit successful otherwise ``False`` """
594+
if self._is_shutting_down:
595+
# block multiple close attempts
596+
return
597+
self._is_shutting_down = True
593598
try:
594599
self._save_position()
595600
# pass the on window close event to the features
596601
for feature in self._all_features():
597602
# if any feature returns false abort shut down
598603
feature.save_window_pos()
599604
if not feature.on_app_close():
605+
self._is_shutting_down = False
600606
return False
601607
if not self.tool_manager.on_app_close():
608+
self._is_shutting_down = False
602609
return False
603610
self.quit()
604611
return True
@@ -609,6 +616,7 @@ def _on_close(self):
609616
if force:
610617
# exit by all means necessary
611618
sys.exit(1)
619+
self._is_shutting_down = False
612620
return False
613621

614622
def get_help(self):

0 commit comments

Comments
 (0)