Skip to content

Commit 6fc37ac

Browse files
committed
canvas/main: Delete the initial window when closed
1 parent 77a6cbf commit 6fc37ac

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Orange/canvas/__main__.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,7 @@ def onrequest(url):
381381
QDir.addSearchPath("canvas_icons", os.path.join(dirpath, "icons"))
382382

383383
canvas_window = CanvasMainWindow()
384+
canvas_window.setAttribute(Qt.WA_DeleteOnClose)
384385
canvas_window.setWindowIcon(config.application_icon())
385386

386387
if stylesheet_string is not None:
@@ -462,8 +463,8 @@ def show_message(message):
462463
canvas_window.load_scheme(open_requests[-1].toLocalFile())
463464

464465
# local references prevent destruction
465-
_ = show_survey()
466-
__ = check_for_updates()
466+
survey = show_survey()
467+
update_check = check_for_updates()
467468

468469
# Tee stdout and stderr into Output dock
469470
log_view = canvas_window.log_view()
@@ -491,12 +492,14 @@ def show_message(message):
491492
status = app.exec_()
492493
except BaseException:
493494
log.error("Error in main event loop.", exc_info=True)
495+
status = 42
494496

495-
canvas_window.deleteLater()
496-
app.processEvents()
497-
app.flush()
498497
del canvas_window
498+
del survey
499+
del update_check
499500

501+
app.processEvents()
502+
app.flush()
500503
# Collect any cycles before deleting the QApplication instance
501504
gc.collect()
502505

0 commit comments

Comments
 (0)