Fix/workaround T37073: Crash updating custom props visible in the UI
This commit is contained in:
		@@ -510,7 +510,22 @@ bool BPy_IDProperty_Map_ValidateAndCreate(PyObject *name_obj, IDProperty *group,
 | 
			
		||||
		MEM_freeN(prop);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
		IDP_ReplaceInGroup(group, prop);
 | 
			
		||||
		IDProperty *prop_exist;
 | 
			
		||||
 | 
			
		||||
		/* avoid freeing when types match incase they are referenced by the UI, see: T37073
 | 
			
		||||
		 * obviously this isn't a complete solution, but helps for common cases. */
 | 
			
		||||
		prop_exist = IDP_GetPropertyFromGroup(group, prop->name);
 | 
			
		||||
		if ((prop_exist != NULL) &&
 | 
			
		||||
		    (prop_exist->type == prop->type) &&
 | 
			
		||||
		    (prop_exist->subtype == prop->subtype))
 | 
			
		||||
		{
 | 
			
		||||
			IDP_FreeProperty(prop_exist);
 | 
			
		||||
			*prop_exist = *prop;
 | 
			
		||||
			MEM_freeN(prop);
 | 
			
		||||
		}
 | 
			
		||||
		else {
 | 
			
		||||
			IDP_ReplaceInGroup_ex(group, prop, prop_exist);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user