Fix memory leak re-registering operators

Re-registering an operator used by the keymap would lead memory.
Reload scripts for eg leaked over ~1600 blocks.
This commit is contained in:
Campbell Barton 2017-03-29 13:26:34 +11:00
parent 02b2094847
commit d808557d15

@ -121,6 +121,13 @@ static void wm_keymap_item_properties_update_ot(wmKeyMapItem *kmi)
if (ot->srna != kmi->ptr->type) {
/* matches wm_keymap_item_properties_set but doesnt alloc new ptr */
WM_operator_properties_create_ptr(kmi->ptr, ot);
/* 'kmi->ptr->data' NULL'd above, keep using existing properties.
* Note: the operators property types may have changed,
* we will need a more comprehensive sanitize function to support this properly.
*/
if (kmi->properties) {
kmi->ptr->data = kmi->properties;
}
WM_operator_properties_sanitize(kmi->ptr, 1);
}
}