summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-04-15 16:34:56 -0300
committerIvan Alejandro <ivanalejandro0@gmail.com>2015-04-16 18:38:16 -0300
commitb2623678d53c27707ea38d222e3dfee0f171ed35 (patch)
tree11e70aa95720233991ec800dda1ec089ddab57c7 /src/leap/bitmask
parent1644e9effe528aa2f95de4c4726704028b0fabc8 (diff)
[bug] do not disable autostart on system quit()
If the quit() call is triggered by the system logout we should not disable the autostart. Otherwise bitmask won't autostart on the next session start. - Resolves: #6424
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/frontend_app.py8
-rw-r--r--src/leap/bitmask/gui/mainwindow.py12
2 files changed, 16 insertions, 4 deletions
diff --git a/src/leap/bitmask/frontend_app.py b/src/leap/bitmask/frontend_app.py
index b0a149f9..55e188f7 100644
--- a/src/leap/bitmask/frontend_app.py
+++ b/src/leap/bitmask/frontend_app.py
@@ -51,7 +51,13 @@ def signal_handler(window, pid, signum, frame):
if pid == my_pid:
pname = multiprocessing.current_process().name
logger.debug("{0}: SIGNAL #{1} catched.".format(pname, signum))
- window.quit()
+ disable_autostart = True
+ if signum == 15: # SIGTERM
+ # Do not disable autostart on SIGTERM since this is the signal that
+ # the system sends to bitmask when the user asks to do a system
+ # logout.
+ disable_autostart = False
+ window.quit(disable_autostart=disable_autostart)
def run_frontend(options, flags_dict, backend_pid=None):
diff --git a/src/leap/bitmask/gui/mainwindow.py b/src/leap/bitmask/gui/mainwindow.py
index 55628847..4b665337 100644
--- a/src/leap/bitmask/gui/mainwindow.py
+++ b/src/leap/bitmask/gui/mainwindow.py
@@ -1054,7 +1054,7 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
if not e.spontaneous():
# if the system requested the `close` then we should quit.
self._system_quit = True
- self.quit()
+ self.quit(disable_autostart=False)
return
if QtGui.QSystemTrayIcon.isSystemTrayAvailable() and \
@@ -1622,18 +1622,24 @@ class MainWindow(QtGui.QMainWindow, SignalTracker):
logger.debug('Terminating vpn')
self._backend.eip_stop(shutdown=True)
- def quit(self):
+ def quit(self, disable_autostart=True):
"""
Start the quit sequence and wait for services to finish.
Cleanup and close the main window before quitting.
+
+ :param disable_autostart: whether we should disable the autostart
+ feature or not
+ :type disable_autostart: bool
"""
if self._quitting:
return
+ if disable_autostart:
+ autostart.set_autostart(False)
+
self._quitting = True
self._close_to_tray = False
logger.debug('Quitting...')
- autostart.set_autostart(False)
# first thing to do quitting, hide the mainwindow and show tooltip.
self.hide()