Skip to content

Commit

Permalink
canvas/main: Delete the initial window when closed
Browse files Browse the repository at this point in the history
  • Loading branch information
ales-erjavec committed Mar 13, 2018
1 parent d19f0a9 commit 5c5ec82
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Orange/canvas/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ def onrequest(url):
QDir.addSearchPath("canvas_icons", os.path.join(dirpath, "icons"))

canvas_window = CanvasMainWindow()
canvas_window.setAttribute(Qt.WA_DeleteOnClose)
canvas_window.setWindowIcon(config.application_icon())

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

# local references prevent destruction
_ = show_survey()
__ = check_for_updates()
survey = show_survey()
update_check = check_for_updates()

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

canvas_window.deleteLater()
app.processEvents()
app.flush()
del canvas_window
del survey
del update_check

app.processEvents()
app.flush()
# Collect any cycles before deleting the QApplication instance
gc.collect()

Expand Down

0 comments on commit 5c5ec82

Please sign in to comment.