summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2015-10-01 17:18:54 -0700
committerCedric BAIL <cedric@osg.samsung.com>2015-10-02 07:52:40 +0200
commita2c2b0fa0373d7add8d5e2b2b7362379797dca6c (patch)
tree39c715ebb95c226e265820bcc7a5c5caac6c14a9
parent3feae5456ed0cdea251ceb439deac9ef43342029 (diff)
ector: don't leak cairo context.
-rw-r--r--src/lib/ector/cairo/ector_cairo_private.h2
-rw-r--r--src/lib/ector/cairo/ector_cairo_surface.c10
-rw-r--r--src/modules/evas/engines/software_generic/ector_surface.c9
3 files changed, 8 insertions, 13 deletions
diff --git a/src/lib/ector/cairo/ector_cairo_private.h b/src/lib/ector/cairo/ector_cairo_private.h
index b5782ffafc..c41cbe30e0 100644
--- a/src/lib/ector/cairo/ector_cairo_private.h
+++ b/src/lib/ector/cairo/ector_cairo_private.h
@@ -18,8 +18,6 @@ struct _Ector_Cairo_Surface_Data
18 struct { 18 struct {
19 double x, y; 19 double x, y;
20 } current; 20 } current;
21
22 Eina_Bool internal : 1;
23}; 21};
24 22
25struct _Ector_Renderer_Cairo_Base_Data 23struct _Ector_Renderer_Cairo_Base_Data
diff --git a/src/lib/ector/cairo/ector_cairo_surface.c b/src/lib/ector/cairo/ector_cairo_surface.c
index 10fef6560e..bd44405f81 100644
--- a/src/lib/ector/cairo/ector_cairo_surface.c
+++ b/src/lib/ector/cairo/ector_cairo_surface.c
@@ -86,13 +86,9 @@ _ector_cairo_surface_context_set(Eo *obj,
86 Ector_Cairo_Surface_Data *pd, 86 Ector_Cairo_Surface_Data *pd,
87 cairo_t *ctx) 87 cairo_t *ctx)
88{ 88{
89 if (pd->internal) 89 USE(obj, cairo_destroy, );
90 {
91 USE(obj, cairo_destroy, );
92 90
93 if (pd->cairo) cairo_destroy(pd->cairo); 91 if (pd->cairo) cairo_destroy(pd->cairo);
94 pd->internal = EINA_FALSE;
95 }
96 if (!ctx) 92 if (!ctx)
97 { 93 {
98 USE(obj, cairo_image_surface_create, ); 94 USE(obj, cairo_image_surface_create, );
@@ -139,6 +135,8 @@ _ector_cairo_surface_eo_base_destructor(Eo *obj EINA_UNUSED,
139{ 135{
140 eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, eo_destructor()); 136 eo_do_super(obj, ECTOR_CAIRO_SURFACE_CLASS, eo_destructor());
141 137
138
139
142 if (--_cairo_count) return ; 140 if (--_cairo_count) return ;
143 if (_cairo_so) eina_module_free(_cairo_so); 141 if (_cairo_so) eina_module_free(_cairo_so);
144 _cairo_so = NULL; 142 _cairo_so = NULL;
diff --git a/src/modules/evas/engines/software_generic/ector_surface.c b/src/modules/evas/engines/software_generic/ector_surface.c
index 78ad59632b..8590768a2a 100644
--- a/src/modules/evas/engines/software_generic/ector_surface.c
+++ b/src/modules/evas/engines/software_generic/ector_surface.c
@@ -48,7 +48,6 @@ typedef struct _Ector_Cairo_Software_Surface_Data Ector_Cairo_Software_Surface_D
48struct _Ector_Cairo_Software_Surface_Data 48struct _Ector_Cairo_Software_Surface_Data
49{ 49{
50 cairo_surface_t *surface; 50 cairo_surface_t *surface;
51 cairo_t *ctx;
52 51
53 void *pixels; 52 void *pixels;
54 53
@@ -59,13 +58,14 @@ struct _Ector_Cairo_Software_Surface_Data
59void 58void
60_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height) 59_ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_Data *pd, void *pixels, unsigned int width, unsigned int height)
61{ 60{
61 cairo_t *ctx = NULL;
62
62 USE(obj, cairo_image_surface_create_for_data, ); 63 USE(obj, cairo_image_surface_create_for_data, );
63 USE(obj, cairo_surface_destroy, ); 64 USE(obj, cairo_surface_destroy, );
64 USE(obj, cairo_create, ); 65 USE(obj, cairo_create, );
65 USE(obj, cairo_destroy, ); 66 USE(obj, cairo_destroy, );
66 67
67 if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL; 68 if (pd->surface) cairo_surface_destroy(pd->surface); pd->surface = NULL;
68 if (pd->ctx) cairo_destroy(pd->ctx); pd->ctx = NULL;
69 69
70 pd->pixels = NULL; 70 pd->pixels = NULL;
71 pd->width = 0; 71 pd->width = 0;
@@ -78,8 +78,7 @@ _ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_
78 width, height, width * sizeof (int)); 78 width, height, width * sizeof (int));
79 if (!pd->surface) goto end; 79 if (!pd->surface) goto end;
80 80
81 pd->ctx = cairo_create(pd->surface); 81 ctx = cairo_create(pd->surface);
82 if (!pd->ctx) goto end;
83 } 82 }
84 83
85 pd->pixels = pixels; 84 pd->pixels = pixels;
@@ -90,7 +89,7 @@ _ector_cairo_software_surface_surface_set(Eo *obj, Ector_Cairo_Software_Surface_
90 evas_common_cpu_end_opt(); 89 evas_common_cpu_end_opt();
91 90
92 eo_do(obj, 91 eo_do(obj,
93 ector_cairo_surface_context_set(pd->ctx), 92 ector_cairo_surface_context_set(ctx),
94 ector_surface_size_set(pd->width, pd->height)); 93 ector_surface_size_set(pd->width, pd->height));
95} 94}
96 95