fix for memory leak in transform when changing transform modes within transform
(if you held down the R-key for example).
This commit is contained in:
parent
b59ba34c37
commit
b2feb19c02
@ -307,15 +307,8 @@ static void calcSpringFactor(MouseInput *mi)
|
||||
|
||||
void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
||||
{
|
||||
/* may have been allocated previously */
|
||||
/* TODO, holding R-key can cause mem leak, but this causes [#28903]
|
||||
* disable for now. */
|
||||
#if 0
|
||||
if (mi->data) {
|
||||
MEM_freeN(mi->data);
|
||||
mi->data = NULL;
|
||||
}
|
||||
#endif
|
||||
/* incase we allocate a new value */
|
||||
void *mi_data_prev = mi->data;
|
||||
|
||||
switch (mode) {
|
||||
case INPUT_VECTOR:
|
||||
@ -374,6 +367,12 @@ void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode)
|
||||
break;
|
||||
}
|
||||
|
||||
/* if we've allocated new data, free the old data
|
||||
* less hassle then checking before every alloc above */
|
||||
if (mi_data_prev && (mi_data_prev != mi->data)) {
|
||||
MEM_freeN(mi_data_prev);
|
||||
}
|
||||
|
||||
/* bootstrap mouse input with initial values */
|
||||
applyMouseInput(t, mi, mi->imval, t->values);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user