Skip to content

Commit

Permalink
Prevent race condition on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
kliment committed Mar 22, 2018
1 parent 062e52c commit 42d7cd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
1 change: 0 additions & 1 deletion printrun/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def createTabbedGui(self):
self.notebook.AddPage(page4panel, _("G-Code Plater"))
self.panel.SetSizer(self.notesizer)
self.panel.Bind(wx.EVT_MOUSE_EVENTS, self.editbutton)
self.Bind(wx.EVT_CLOSE, self.kill)

# Custom buttons
self.cbuttonssizer = wx.WrapSizer(wx.HORIZONTAL)
Expand Down
8 changes: 6 additions & 2 deletions printrun/pronterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(self, app, filename = None, size = winsize):
self.Bind(wx.EVT_SIZE, self.on_resize)
self.Bind(wx.EVT_MAXIMIZE, self.on_maximize)
self.window_ready = True

self.Bind(wx.EVT_CLOSE, self.closewin)
# set feedrates in printcore for pause/resume
self.p.xy_feedrate = self.settings.xy_feedrate
self.p.z_feedrate = self.settings.z_feedrate
Expand Down Expand Up @@ -331,7 +331,11 @@ def on_maximize(self, event):
def on_exit(self, event):
self.Close()

def kill(self, e):
def closewin(self, e):
e.StopPropagation()
self.do_exit("")

def kill(self, e=None):
if self.p.printing or self.p.paused:
dlg = wx.MessageDialog(self, _("Print in progress ! Are you really sure you want to quit ?"), _("Exit"), wx.YES_NO | wx.ICON_WARNING)
if dlg.ShowModal() == wx.ID_NO:
Expand Down

0 comments on commit 42d7cd0

Please sign in to comment.