Hi devs,
Posting this to keep track of what I have found so far, and see whether
others devs have ideas about the problem...
So, this is about instant segfault that is regularly reported by users
when trying to reload python code with F8 shortcut. I finally managed to
find (I think!) what is the issue: it appears when one or more addons
which define keymaps are enabled.
Now, I gdb-tracked it down to WM_keyconfig_update(), wm_keymap.c:1104.
Here, kmdi->add_item->ptr PointerRNA seems to be corrupted some way,
just after reload (at least its type (StructRNA) member, sometimes it
has a NULL identifier, and invalid description/translation_context
pointers, sometimes it points to a wrong type...).
I tried to force this pointer to NULL (see *ugly* patch attached, or
http://www.pasteall.org/41030/diff ), and everything seems to work fine
again.
Questions are: why those PointerRNA become corrupted? Because of py
reloading, which deletes/recreates some RNA structs (operators, menus,
etc.)?
And would that kind of patch be considered as acceptable?
Best regards,
Bastien
Index: source/blender/windowmanager/intern/wm_keymap.c
===================================================================
--- source/blender/windowmanager/intern/wm_keymap.c (révision 55756)
+++ source/blender/windowmanager/intern/wm_keymap.c (copie de travail)
@@ -1100,10 +1100,20 @@
for (km = U.user_keymaps.first; km; km = km->next) {
if ((km->flag & KEYMAP_MODAL) == 0) {
for (kmdi = km->diff_items.first; kmdi; kmdi = kmdi->next) {
- if (kmdi->add_item)
+ if (kmdi->add_item) {
+ if (kmdi->add_item->ptr) {
+ MEM_freeN(kmdi->add_item->ptr);
+ kmdi->add_item->ptr = NULL;
+ }
wm_keymap_item_properties_set(kmdi->add_item);
- if (kmdi->remove_item)
+ }
+ if (kmdi->remove_item) {
+ if (kmdi->remove_item->ptr) {
+ MEM_freeN(kmdi->remove_item->ptr);
+ kmdi->remove_item->ptr = NULL;
+ }
wm_keymap_item_properties_set(kmdi->remove_item);
+ }
}
for (kmi = km->items.first; kmi; kmi = kmi->next)
_______________________________________________
Bf-committers mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-committers