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 Jan 3, 2018
1 parent 4eb1861 commit 6938fdc
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 @@ -369,6 +369,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 @@ -450,8 +451,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 @@ -479,12 +480,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 6938fdc

Please sign in to comment.