[Cogl] [PATCH] cogl-path: fix segfault in _cogl_clip_stack_push_from_path

Andreas Oberritter obi at saftware.de
Tue Jul 9 05:15:45 PDT 2013


When calling cogl_framebuffer_push_path_clip with a non-rectangle path,
_cogl_clip_stack_push_primitive was called with a NULL primitive.

Signed-off-by: Andreas Oberritter <obi at saftware.de>
---
Although this fixes the segfault, the result looks wrong. A test case:

CoglPath *path = cogl_path_new(ctx);
cogl_path_set_fill_rule(path, COGL_PATH_FILL_RULE_NON_ZERO);
for ([more than once]) {
    [get coordinates]
    cogl_path_rectangle(path, x1, y1, x2, y2);
}
cogl_framebuffer_push_path_clip(fb, path);
cogl_object_unref(path);

This code path worked well until cogl-path was moved to its own library.

Regards,
Andreas

 cogl-path/cogl-path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cogl-path/cogl-path.c b/cogl-path/cogl-path.c
index be8bb04..ad53193 100644
--- a/cogl-path/cogl-path.c
+++ b/cogl-path/cogl-path.c
@@ -1434,7 +1434,7 @@ _cogl_clip_stack_push_from_path (CoglClipStack *stack,
   else
     {
       return _cogl_clip_stack_push_primitive (stack,
-                                              path->data->fill_primitive,
+                                              _cogl_path_get_fill_primitive (path),
                                               x_1, y_1, x_2, y_2,
                                               modelview_entry,
                                               projection_entry,
-- 
1.8.1.2



More information about the Cogl mailing list