Skip to content

Commit 0de29a9

Browse files
committed
Destroy widget on early reaction
Allows the widget to be destroyed before the action completes.
1 parent aa0e439 commit 0de29a9

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

qui/tray/domains.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,14 +283,11 @@ def react_to_question(self, widget, response, action):
283283
asyncio.create_task(self.react_to_question_async(widget, response, action))
284284

285285
async def react_to_question_async(self, widget, response, action):
286-
if response not in (Gtk.ResponseType.OK, Gtk.ResponseType.YES):
287-
widget.destroy()
288-
return
286+
widget.destroy()
289287
try:
290288
await self.shutdown_from_response(response, action)
291289
except exc.QubesException as ex:
292290
self.show_shutdown_dialog(ex)
293-
widget.destroy()
294291

295292
async def shutdown_from_response(self, response, action):
296293
if action == "force":
@@ -352,17 +349,16 @@ def react_to_question(self, widget, response, action):
352349
asyncio.create_task(self.react_to_question_async(widget, response, action))
353350

354351
async def react_to_question_async(self, widget, response, action):
352+
widget.destroy()
355353
if response not in (Gtk.ResponseType.OK, Gtk.ResponseType.YES):
356354
self.give_up = True
357-
widget.destroy()
358355
return
359356
try:
360357
await self.shutdown_from_response(response, action)
361358
except exc.QubesException as ex:
362359
self.show_shutdown_dialog(ex)
363360
else:
364361
await self.start()
365-
widget.destroy()
366362

367363

368364
class KillItem(VMActionMenuItem):

0 commit comments

Comments
 (0)