Skip to content

Commit 4f694a7

Browse files
committed
canvas/main: Delete the initial window when closed
1 parent 2036577 commit 4f694a7

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
@@ -400,6 +400,7 @@ def onrequest(url):
400400
QDir.addSearchPath("canvas_icons", os.path.join(dirpath, "icons"))
401401

402402
canvas_window = CanvasMainWindow()
403+
canvas_window.setAttribute(Qt.WA_DeleteOnClose)
403404
canvas_window.setWindowIcon(config.application_icon())
404405

405406
if stylesheet_string is not None:
@@ -481,8 +482,8 @@ def show_message(message):
481482
canvas_window.load_scheme(open_requests[-1].toLocalFile())
482483

483484
# local references prevent destruction
484-
_ = show_survey()
485-
__ = check_for_updates()
485+
survey = show_survey()
486+
update_check = check_for_updates()
486487

487488
# Tee stdout and stderr into Output dock
488489
log_view = canvas_window.log_view()
@@ -510,12 +511,14 @@ def show_message(message):
510511
status = app.exec_()
511512
except BaseException:
512513
log.error("Error in main event loop.", exc_info=True)
514+
status = 42
513515

514-
canvas_window.deleteLater()
515-
app.processEvents()
516-
app.flush()
517516
del canvas_window
517+
del survey
518+
del update_check
518519

520+
app.processEvents()
521+
app.flush()
519522
# Collect any cycles before deleting the QApplication instance
520523
gc.collect()
521524

0 commit comments

Comments
 (0)