[grits] Fix crash on osx due to uninitialized pointer



commit 7d6c932ebdf23526295127dad8220a1db88434e1
Author: Andy Spencer <andy753421 gmail com>
Date:   Sun Dec 30 06:53:08 2012 +0000

    Fix crash on osx due to uninitialized pointer

 src/roam.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/src/roam.c b/src/roam.c
index 806eb3f..e58cd1d 100644
--- a/src/roam.c
+++ b/src/roam.c
@@ -631,6 +631,7 @@ RoamSphere *roam_sphere_new()
 	sphere->polys       = 8;
 	sphere->triangles   = g_pqueue_new((GCompareDataFunc)tri_cmp, NULL);
 	sphere->diamonds    = g_pqueue_new((GCompareDataFunc)dia_cmp, NULL);
+	sphere->view        = g_new0(RoamView, 1);
 
 	RoamPoint *vertexes[] = {
 		roam_point_new( 90,   0,  0), // 0 (North)
@@ -684,8 +685,6 @@ RoamSphere *roam_sphere_new()
  */
 void roam_sphere_update_view(RoamSphere *sphere)
 {
-	if (!sphere->view)
-		sphere->view = g_new0(RoamView, 1);
 	glGetDoublev (GL_MODELVIEW_MATRIX,  sphere->view->model);
 	glGetDoublev (GL_PROJECTION_MATRIX, sphere->view->proj);
 	glGetIntegerv(GL_VIEWPORT,          sphere->view->view);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]