mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
cogl-primitive: Fix some broken changes for removal of NULL terminator
Commit 3c1e83c7
changed uses of arrays of CoglAttributes to take a
length instead of being NULL terminated. In cogl_primitive_new it was
still adding the NULL terminator to the array it passes to
cogl_primitive_new_with_attributes but then it was also including this
terminator in the count so it would just segfault when it tries to ref
the NULL pointer. Also _cogl_primitive_new_with_attributes_unref was
still trying to detect the NULL terminator so it would also crash.
This commit is contained in:
parent
f23a387359
commit
eb109e6cc0
@ -87,7 +87,7 @@ _cogl_primitive_new_with_attributes_unref (CoglVerticesMode mode,
|
|||||||
attributes,
|
attributes,
|
||||||
n_attributes);
|
n_attributes);
|
||||||
|
|
||||||
for (i = 0; attributes[i]; i++)
|
for (i = 0; i < n_attributes; i++)
|
||||||
cogl_object_unref (attributes[i]);
|
cogl_object_unref (attributes[i]);
|
||||||
|
|
||||||
return primitive;
|
return primitive;
|
||||||
@ -109,8 +109,7 @@ cogl_primitive_new (CoglVerticesMode mode,
|
|||||||
;
|
;
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
||||||
attributes = g_alloca (sizeof (CoglAttribute *) * (n_attributes + 1));
|
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
||||||
attributes[n_attributes] = NULL;
|
|
||||||
|
|
||||||
va_start (ap, n_vertices);
|
va_start (ap, n_vertices);
|
||||||
for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
|
for (i = 0; (attribute = va_arg (ap, CoglAttribute *)); i++)
|
||||||
@ -119,7 +118,7 @@ cogl_primitive_new (CoglVerticesMode mode,
|
|||||||
|
|
||||||
return cogl_primitive_new_with_attributes (mode, n_vertices,
|
return cogl_primitive_new_with_attributes (mode, n_vertices,
|
||||||
attributes,
|
attributes,
|
||||||
i + 1);
|
i);
|
||||||
}
|
}
|
||||||
|
|
||||||
CoglPrimitive *
|
CoglPrimitive *
|
||||||
|
Loading…
Reference in New Issue
Block a user