[cogl] cogl-primitive: Fix some broken changes for removal of NULL terminator
- From: Neil Roberts <nroberts src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [cogl] cogl-primitive: Fix some broken changes for removal of NULL terminator
- Date: Mon, 16 May 2011 17:34:29 +0000 (UTC)
commit eb109e6cc09e9024ad5303f02e34bc2de00ad8e7
Author: Neil Roberts <neil linux intel com>
Date: Mon May 16 16:34:48 2011 +0100
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.
cogl/cogl-primitive.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/cogl/cogl-primitive.c b/cogl/cogl-primitive.c
index b47c418..dace7c6 100644
--- a/cogl/cogl-primitive.c
+++ b/cogl/cogl-primitive.c
@@ -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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]