fix: Python.exe sometimes dont shut down in task manager processes

fix: disconnect attempt when the session is not running

Related to slumber/multi-user#94
This commit is contained in:
Swann 2020-07-07 10:58:34 +02:00
parent e2cdd26b7c
commit 25f3e27b7f
No known key found for this signature in database
GPG Key ID: 5E0D936BD280E963
3 changed files with 16 additions and 14 deletions

View File

@ -47,7 +47,8 @@ from . import environment, utils
DEPENDENCIES = {
("zmq","zmq"),
("jsondiff","jsondiff"),
("deepdiff", "deepdiff")
("deepdiff", "deepdiff"),
("psutil","psutil")
}

@ -1 +1 @@
Subproject commit 5e0b0766d7a6724f7b7beeeb62696d6d2d5193a6
Subproject commit 3400d7c293ba181139931d0dd9a797fe804df2e8

View File

@ -198,7 +198,7 @@ class SessionInitOperator(bpy.types.Operator):
@classmethod
def poll(cls, context):
return True
def draw(self, context):
layout = self.layout
col = layout.column()
@ -210,18 +210,18 @@ class SessionInitOperator(bpy.types.Operator):
def execute(self, context):
global client
if self.init_method == 'EMPTY':
utils.clean_scene()
for scene in bpy.data.scenes:
client.add(scene)
client.init()
return {"FINISHED"}
class SessionStopOperator(bpy.types.Operator):
bl_idname = "session.stop"
bl_label = "close"
@ -234,12 +234,15 @@ class SessionStopOperator(bpy.types.Operator):
def execute(self, context):
global client, delayables, stop_modal_executor
assert(client)
try:
client.disconnect()
except Exception as e:
self.report({'ERROR'}, repr(e))
if client:
try:
client.disconnect()
except Exception as e:
self.report({'ERROR'}, repr(e))
else:
self.report({'WARNING'}, "No session to quit.")
return {"FINISHED"}
return {"FINISHED"}
@ -558,6 +561,7 @@ classes = (
)
@persistent
def sanitize_deps_graph(dummy):
"""sanitize deps graph
@ -594,7 +598,6 @@ def register():
for cls in classes:
register_class(cls)
bpy.app.handlers.undo_post.append(sanitize_deps_graph)
bpy.app.handlers.redo_post.append(sanitize_deps_graph)
@ -602,7 +605,6 @@ def register():
bpy.app.handlers.frame_change_pre.append(update_client_frame)
def unregister():
global client
@ -617,7 +619,6 @@ def unregister():
bpy.app.handlers.undo_post.remove(sanitize_deps_graph)
bpy.app.handlers.redo_post.remove(sanitize_deps_graph)
bpy.app.handlers.load_pre.remove(load_pre_handler)
bpy.app.handlers.frame_change_pre.remove(update_client_frame)