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,
|
||||
n_attributes);
|
||||
|
||||
for (i = 0; attributes[i]; i++)
|
||||
for (i = 0; i < n_attributes; i++)
|
||||
cogl_object_unref (attributes[i]);
|
||||
|
||||
return primitive;
|
||||
@ -109,8 +109,7 @@ cogl_primitive_new (CoglVerticesMode mode,
|
||||
;
|
||||
va_end (ap);
|
||||
|
||||
attributes = g_alloca (sizeof (CoglAttribute *) * (n_attributes + 1));
|
||||
attributes[n_attributes] = NULL;
|
||||
attributes = g_alloca (sizeof (CoglAttribute *) * n_attributes);
|
||||
|
||||
va_start (ap, n_vertices);
|
||||
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,
|
||||
attributes,
|
||||
i + 1);
|
||||
i);
|
||||
}
|
||||
|
||||
CoglPrimitive *
|
||||
|
Loading…
Reference in New Issue
Block a user