destroy any mobility player dialog before joinning a different session, pass in old_session_id to Menuaction.cleanup_old_session() so that the old session is deleted rather than the new one

This commit is contained in:
Huy Pham 2020-01-20 16:01:46 -08:00
parent b0087bbde1
commit b6f68e0b06
2 changed files with 11 additions and 4 deletions

View file

@ -32,10 +32,10 @@ class MenuAction:
self.app = app
self.canvas = app.canvas
def cleanup_old_session(self):
def cleanup_old_session(self, session_id):
logging.info("cleaning up old session")
self.app.core.stop_session()
self.app.core.delete_session()
self.app.core.delete_session(session_id)
def prompt_save_running_session(self, quitapp: bool = False):
"""
@ -49,7 +49,12 @@ class MenuAction:
callback = None
if quitapp:
callback = self.app.quit
task = BackgroundTask(self.app, self.cleanup_old_session, callback)
task = BackgroundTask(
self.app,
self.cleanup_old_session,
callback,
(self.app.core.session_id,),
)
task.start()
elif quitapp:
self.app.quit()