py/rna update, reload works again.

- fix for reload (f8) crashing, missing incref when creating the script namespace.
- store the module names rather then the modules for reloading incase the modules get out of date.
This commit is contained in:
Campbell Barton
2010-08-03 03:53:36 +00:00
parent c475f38239
commit 233df907d0
4 changed files with 40 additions and 50 deletions

View File

@@ -44,17 +44,17 @@ def get_console(console_id):
from code import InteractiveConsole
consoles = getattr(get_console, "consoles", None)
hash_next = hash(bpy.context.manager)
if consoles is None:
consoles = get_console.consoles = {}
get_console.consoles_namespace_hash = hash(bpy.context.manager)
get_console.consoles_namespace_hash = hash_next
else:
# check if clearning the namespace is needed to avoid a memory leak.
# the window manager is normally loaded with new blend files
# so this is a reasonable way to deal with namespace clearing.
# bpy.data hashing is reset by undo so cant be used.
hash_prev = getattr(get_console, "consoles_namespace_hash", 0)
hash_next = hash(bpy.context.manager)
if hash_prev != hash_next:
get_console.consoles_namespace_hash = hash_next