Skip to content

Commit 962669b

Browse files
committed
qtvcp -change exit clean up code.
Hoping to help the segfault on exit problem - it didn't. But this does make more logical sense: cleanup before entering close event
1 parent 383fc1e commit 962669b

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

lib/python/qtvcp/widgets/screen_options.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,21 +390,25 @@ def closeEvent(self, event):
390390
# system shutdown
391391
HANDLER = self.QTVCP_INSTANCE_.handler_instance
392392
if answer == QtWidgets.QMessageBox.DestructiveRole:
393+
self.QTVCP_INSTANCE_.settings.sync()
394+
self.QTVCP_INSTANCE_.shutdown()
395+
self.QTVCP_INSTANCE_.panel_.shutdown()
396+
STATUS.shutdown()
393397
if 'system_shutdown_request__' in dir(HANDLER):
394398
HANDLER.system_shutdown_request__()
395399
else:
396400
from qtvcp.core import Action
397401
ACTION = Action()
398402
ACTION.SHUT_SYSTEM_DOWN_PROMPT()
399-
if '_hal_cleanup' in dir(HANDLER):
400-
HANDLER._hal_cleanup()
401403
event.accept()
402404
# close linuxcnc
403405
elif answer:
404406
if self.PREFS_ and self.play_sounds and self.shutdown_play_sound:
405407
STATUS.emit('play-sound', self.shutdown_exit_sound_type)
406-
if '_hal_cleanup' in dir(HANDLER):
407-
HANDLER._hal_cleanup()
408+
self.QTVCP_INSTANCE_.settings.sync()
409+
self.QTVCP_INSTANCE_.shutdown()
410+
self.QTVCP_INSTANCE_.panel_.shutdown()
411+
STATUS.shutdown()
408412
event.accept()
409413
# cancel
410414
elif answer == False:

src/emc/usr_intf/qtvcp/qtvcp.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,7 @@ def __init__(self):
420420

421421
LOG.info('Preference path: yellow<{}>'.format(PATH.PREFS_FILENAME))
422422
# start loop
423-
APP.exec_()
424-
425-
# now shut it all down
426-
self.shutdown()
423+
APP.exec()
427424

428425
# finds the postgui file name and INI file path
429426
def postgui(self):
@@ -452,6 +449,7 @@ def postgui_cmd(self):
452449
# call optional widget cleanup functions
453450
# shut down STATUS so no error is called
454451
# close out HAL pins
452+
# there is similar code in screen_options
455453
def shutdown(self,signum=None,stack_frame=None):
456454
try:
457455
self.panel.window.shutdown()
@@ -467,7 +465,6 @@ def shutdown(self,signum=None,stack_frame=None):
467465
self.halcomp.exit()
468466
except:
469467
pass
470-
sys.exit(0)
471468

472469
# Throws up a dialog with debug info when an error is encountered
473470
def excepthook(self, exc_type, exc_obj, exc_tb):
@@ -512,4 +509,4 @@ def excepthook(self, exc_type, exc_obj, exc_tb):
512509
# starts Qtvcp
513510
if __name__ == "__main__":
514511
APP = QTVCP()
515-
512+
sys.exit(0)

0 commit comments

Comments
 (0)