Fix T82493: PyDoc generation throws exception on exit
Since add-ons now unregister on exit
(as of fa566157a5
)
clearing functions in `bpy.app.handlers` caused an error on exit.
Resolve by restoring handlers before exiting.
This commit is contained in:
parent
056c9de30d
commit
07db110add
|
@ -2188,9 +2188,20 @@ def setup_blender():
|
|||
|
||||
# Remove handlers since the functions get included
|
||||
# in the doc-string and don't have meaningful names.
|
||||
for ls in bpy.app.handlers:
|
||||
if isinstance(ls, list):
|
||||
ls.clear()
|
||||
lists_to_restore = []
|
||||
for var in bpy.app.handlers:
|
||||
if isinstance(var, list):
|
||||
lists_to_restore.append((var[:], var))
|
||||
var.clear()
|
||||
|
||||
return {
|
||||
"lists_to_restore": lists_to_restore,
|
||||
}
|
||||
|
||||
|
||||
def teardown_blender(setup_data):
|
||||
for var_src, var_dst in setup_data["lists_to_restore"]:
|
||||
var_dst[:] = var_src
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -2199,7 +2210,7 @@ def main():
|
|||
setup_monkey_patch()
|
||||
|
||||
# Perform changes to Blender it's self.
|
||||
setup_blender()
|
||||
setup_data = setup_blender()
|
||||
|
||||
# eventually, create the dirs
|
||||
for dir_path in [ARGS.output_dir, SPHINX_IN]:
|
||||
|
@ -2305,6 +2316,8 @@ def main():
|
|||
shutil.copy(os.path.join(SPHINX_OUT_PDF, "contents.pdf"),
|
||||
os.path.join(REFERENCE_PATH, BLENDER_PDF_FILENAME))
|
||||
|
||||
teardown_blender(setup_data)
|
||||
|
||||
sys.exit()
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue