[cogl] matrix: init flags before tmp _translate in _look_at



commit a054b53891c2aa7416262bd22d3eeb0d1a8e9f61
Author: Robert Bragg <robert linux intel com>
Date:   Mon Oct 17 10:00:13 2011 +0100

    matrix: init flags before tmp  _translate in _look_at
    
    In cogl_matrix_look_at we have a tmp CoglMatrix allocated on the stack
    but we weren't initializing its flags before passing it to
    cogl_matrix_translate which meant if we were using COGL_DEBUG=matrices
    we would end up trying to print out an invalid matrix type resulting in
    a crash when overrunning an array of type names.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl/cogl-matrix.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/cogl/cogl-matrix.c b/cogl/cogl-matrix.c
index 7941bb6..f0bcdb7 100644
--- a/cogl/cogl-matrix.c
+++ b/cogl/cogl-matrix.c
@@ -2107,9 +2107,9 @@ cogl_matrix_look_at (CoglMatrix *matrix,
   tmp.zw = 0;
   tmp.ww = 1;
 
-  cogl_matrix_translate (&tmp, -eye_position_x, -eye_position_y, -eye_position_z);
-
   tmp.flags = (MAT_FLAG_GENERAL_3D | MAT_DIRTY_TYPE | MAT_DIRTY_INVERSE);
 
+  cogl_matrix_translate (&tmp, -eye_position_x, -eye_position_y, -eye_position_z);
+
   cogl_matrix_multiply (matrix, matrix, &tmp);
 }



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