summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-07 08:02:32 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-07 08:02:32 +0000
commit921b861f6fb4f21c522195c9b08b1631b542ad81 (patch)
tree63bdad9b4922cae6ae0d83356817bd7c83ec2eee /legacy
parentee49da76654fecda48c70d0b50dc8b658e1b8232 (diff)
fix evas map leak.
SVN revision: 76286
Diffstat (limited to 'legacy')
-rw-r--r--legacy/evas/ChangeLog1
-rw-r--r--legacy/evas/NEWS1
-rw-r--r--legacy/evas/src/lib/canvas/evas_map.c27
-rw-r--r--legacy/evas/src/lib/canvas/evas_object_main.c7
-rw-r--r--legacy/evas/src/lib/canvas/evas_render.c58
-rw-r--r--legacy/evas/src/lib/include/evas_private.h9
6 files changed, 60 insertions, 43 deletions
diff --git a/legacy/evas/ChangeLog b/legacy/evas/ChangeLog
index bf5ff5ccbc..7ef8fa5502 100644
--- a/legacy/evas/ChangeLog
+++ b/legacy/evas/ChangeLog
@@ -1034,3 +1034,4 @@
1034 1034
1035 * Fix image alpha set bug if the image data has not been loaded 1035 * Fix image alpha set bug if the image data has not been loaded
1036 yet from disk. Fixes across software and gl engines needed. 1036 yet from disk. Fixes across software and gl engines needed.
1037 * Fix map surface leak.
diff --git a/legacy/evas/NEWS b/legacy/evas/NEWS
index d7c69ac43b..e261d9592a 100644
--- a/legacy/evas/NEWS
+++ b/legacy/evas/NEWS
@@ -17,6 +17,7 @@ Fixes:
17 * Fix segmentation fault with the esvg loader. 17 * Fix segmentation fault with the esvg loader.
18 * Fix EGL/GLES dest alpha rendering bug (no rendering). 18 * Fix EGL/GLES dest alpha rendering bug (no rendering).
19 * Fix evas_object_image_alpha_set when image data not loaded yet. 19 * Fix evas_object_image_alpha_set when image data not loaded yet.
20 * Fix map surface leak.
20 21
21Evas 1.7.0 22Evas 1.7.0
22 23
diff --git a/legacy/evas/src/lib/canvas/evas_map.c b/legacy/evas/src/lib/canvas/evas_map.c
index ee6a4c8a9f..4466d8a4dc 100644
--- a/legacy/evas/src/lib/canvas/evas_map.c
+++ b/legacy/evas/src/lib/canvas/evas_map.c
@@ -166,9 +166,6 @@ _evas_map_free(Evas_Object *obj, Evas_Map *m)
166{ 166{
167 if (obj) 167 if (obj)
168 { 168 {
169 if (m->surface)
170 obj->layer->evas->engine.func->image_map_surface_free
171 (obj->layer->evas->engine.data.output, m->surface);
172 if (obj->spans) 169 if (obj->spans)
173 { 170 {
174 obj->layer->evas->engine.func->image_map_clean(obj->layer->evas->engine.data.output, obj->spans); 171 obj->layer->evas->engine.func->image_map_clean(obj->layer->evas->engine.data.output, obj->spans);
@@ -408,6 +405,13 @@ evas_object_map_enable_set(Evas_Object *obj, Eina_Bool enabled)
408 } 405 }
409 else 406 else
410 { 407 {
408 if (obj->map.surface)
409 {
410 obj->layer->evas->engine.func->image_map_surface_free
411 (obj->layer->evas->engine.data.output,
412 obj->map.surface);
413 obj->map.surface = NULL;
414 }
411 if (obj->cur.map) 415 if (obj->cur.map)
412 { 416 {
413 _evas_map_calc_geom_change(obj); 417 _evas_map_calc_geom_change(obj);
@@ -449,19 +453,18 @@ evas_object_map_set(Evas_Object *obj, const Evas_Map *map)
449 return; 453 return;
450 MAGIC_CHECK_END(); 454 MAGIC_CHECK_END();
451 455
452 if (!map || map->count < 4) 456 if ((!map) || (map->count < 4))
453 { 457 {
458 if (obj->map.surface)
459 {
460 obj->layer->evas->engine.func->image_map_surface_free
461 (obj->layer->evas->engine.data.output,
462 obj->map.surface);
463 obj->map.surface = NULL;
464 }
454 if (obj->cur.map) 465 if (obj->cur.map)
455 { 466 {
456 obj->changed_map = EINA_TRUE; 467 obj->changed_map = EINA_TRUE;
457
458 if (obj->cur.map->surface)
459 {
460 obj->layer->evas->engine.func->image_map_surface_free
461 (obj->layer->evas->engine.data.output,
462 obj->cur.map->surface);
463 obj->cur.map->surface = NULL;
464 }
465 obj->prev.geometry = obj->cur.map->normal_geometry; 468 obj->prev.geometry = obj->cur.map->normal_geometry;
466 469
467 if (obj->prev.map == obj->cur.map) 470 if (obj->prev.map == obj->cur.map)
diff --git a/legacy/evas/src/lib/canvas/evas_object_main.c b/legacy/evas/src/lib/canvas/evas_object_main.c
index 80f4d9da1e..71dacb10f3 100644
--- a/legacy/evas/src/lib/canvas/evas_object_main.c
+++ b/legacy/evas/src/lib/canvas/evas_object_main.c
@@ -66,6 +66,13 @@ evas_object_free(Evas_Object *obj, int clean_layer)
66 evas_object_map_set(obj, NULL); 66 evas_object_map_set(obj, NULL);
67 if (obj->prev.map) evas_map_free(obj->prev.map); 67 if (obj->prev.map) evas_map_free(obj->prev.map);
68 if (obj->cache_map) evas_map_free(obj->cache_map); 68 if (obj->cache_map) evas_map_free(obj->cache_map);
69 if (obj->map.surface)
70 {
71 obj->layer->evas->engine.func->image_map_surface_free
72 (obj->layer->evas->engine.data.output,
73 obj->map.surface);
74 obj->map.surface = NULL;
75 }
69 evas_object_grabs_cleanup(obj); 76 evas_object_grabs_cleanup(obj);
70 evas_object_intercept_cleanup(obj); 77 evas_object_intercept_cleanup(obj);
71 if (obj->smart.parent) was_smart_child = 1; 78 if (obj->smart.parent) was_smart_child = 1;
diff --git a/legacy/evas/src/lib/canvas/evas_render.c b/legacy/evas/src/lib/canvas/evas_render.c
index 89de64e517..e6eff0cfb9 100644
--- a/legacy/evas/src/lib/canvas/evas_render.c
+++ b/legacy/evas/src/lib/canvas/evas_render.c
@@ -861,27 +861,27 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
861 } 861 }
862 evas_object_map_update(obj, off_x, off_y, sw, sh, sw, sh); 862 evas_object_map_update(obj, off_x, off_y, sw, sh, sw, sh);
863 863
864 if (obj->cur.map->surface) 864 if (obj->map.surface)
865 { 865 {
866 if ((obj->cur.map->surface_w != sw) || 866 if ((obj->map.surface_w != sw) ||
867 (obj->cur.map->surface_h != sh)) 867 (obj->map.surface_h != sh))
868 { 868 {
869 RDI(level); 869 RDI(level);
870 RD(" new surf: %ix%i\n", sw, sh); 870 RD(" new surf: %ix%i\n", sw, sh);
871 obj->layer->evas->engine.func->image_map_surface_free 871 obj->layer->evas->engine.func->image_map_surface_free
872 (e->engine.data.output, obj->cur.map->surface); 872 (e->engine.data.output, obj->map.surface);
873 obj->cur.map->surface = NULL; 873 obj->map.surface = NULL;
874 } 874 }
875 } 875 }
876 if (!obj->cur.map->surface) 876 if (!obj->map.surface)
877 { 877 {
878 obj->cur.map->surface_w = sw; 878 obj->map.surface_w = sw;
879 obj->cur.map->surface_h = sh; 879 obj->map.surface_h = sh;
880 880
881 obj->cur.map->surface = 881 obj->map.surface =
882 obj->layer->evas->engine.func->image_map_surface_new 882 obj->layer->evas->engine.func->image_map_surface_new
883 (e->engine.data.output, obj->cur.map->surface_w, 883 (e->engine.data.output, obj->map.surface_w,
884 obj->cur.map->surface_h, 884 obj->map.surface_h,
885 obj->cur.map->alpha); 885 obj->cur.map->alpha);
886 RDI(level); 886 RDI(level);
887 RD(" fisrt surf: %ix%i\n", sw, sh); 887 RD(" fisrt surf: %ix%i\n", sw, sh);
@@ -923,7 +923,7 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
923 obj->prev.valid_map = EINA_FALSE; 923 obj->prev.valid_map = EINA_FALSE;
924 924
925 // clear surface before re-render 925 // clear surface before re-render
926 if ((changed) && (obj->cur.map->surface)) 926 if ((changed) && (obj->map.surface))
927 { 927 {
928 int off_x2, off_y2; 928 int off_x2, off_y2;
929 929
@@ -940,10 +940,10 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
940 (e->engine.data.output, ctx, EVAS_RENDER_COPY); 940 (e->engine.data.output, ctx, EVAS_RENDER_COPY);
941 e->engine.func->rectangle_draw(e->engine.data.output, 941 e->engine.func->rectangle_draw(e->engine.data.output,
942 ctx, 942 ctx,
943 obj->cur.map->surface, 943 obj->map.surface,
944 0, 0, 944 0, 0,
945 obj->cur.map->surface_w, 945 obj->map.surface_w,
946 obj->cur.map->surface_h); 946 obj->map.surface_h);
947 e->engine.func->context_free(e->engine.data.output, ctx); 947 e->engine.func->context_free(e->engine.data.output, ctx);
948 } 948 }
949 ctx = e->engine.func->context_new(e->engine.data.output); 949 ctx = e->engine.func->context_new(e->engine.data.output);
@@ -955,7 +955,7 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
955 (evas_object_smart_members_get_direct(obj), obj2) 955 (evas_object_smart_members_get_direct(obj), obj2)
956 { 956 {
957 clean_them |= evas_render_mapped(e, obj2, ctx, 957 clean_them |= evas_render_mapped(e, obj2, ctx,
958 obj->cur.map->surface, 958 obj->map.surface,
959 off_x2, off_y2, 1, 959 off_x2, off_y2, 1,
960 ecx, ecy, ecw, ech 960 ecx, ecy, ecw, ech
961#ifdef REND_DGB 961#ifdef REND_DGB
@@ -968,8 +968,8 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
968 { 968 {
969 int x = 0, y = 0, w = 0, h = 0; 969 int x = 0, y = 0, w = 0, h = 0;
970 970
971 w = obj->cur.map->surface_w; 971 w = obj->map.surface_w;
972 h = obj->cur.map->surface_h; 972 h = obj->map.surface_h;
973 RECTS_CLIP_TO_RECT(x, y, w, h, 973 RECTS_CLIP_TO_RECT(x, y, w, h,
974 obj->cur.geometry.x + off_x2, 974 obj->cur.geometry.x + off_x2,
975 obj->cur.geometry.y + off_y2, 975 obj->cur.geometry.y + off_y2,
@@ -979,7 +979,7 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
979 e->engine.func->context_clip_set(e->engine.data.output, 979 e->engine.func->context_clip_set(e->engine.data.output,
980 ctx, x, y, w, h); 980 ctx, x, y, w, h);
981 obj->func->render(obj, e->engine.data.output, ctx, 981 obj->func->render(obj, e->engine.data.output, ctx,
982 obj->cur.map->surface, off_x2, off_y2); 982 obj->map.surface, off_x2, off_y2);
983 } 983 }
984 e->engine.func->context_free(e->engine.data.output, ctx); 984 e->engine.func->context_free(e->engine.data.output, ctx);
985 rendered = EINA_TRUE; 985 rendered = EINA_TRUE;
@@ -990,14 +990,14 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
990 990
991 if (rendered) 991 if (rendered)
992 { 992 {
993 obj->cur.map->surface = e->engine.func->image_dirty_region 993 obj->map.surface = e->engine.func->image_dirty_region
994 (e->engine.data.output, obj->cur.map->surface, 994 (e->engine.data.output, obj->map.surface,
995 0, 0, obj->cur.map->surface_w, obj->cur.map->surface_h); 995 0, 0, obj->map.surface_w, obj->map.surface_h);
996 obj->cur.valid_map = EINA_TRUE; 996 obj->cur.valid_map = EINA_TRUE;
997 } 997 }
998 e->engine.func->context_clip_unset(e->engine.data.output, 998 e->engine.func->context_clip_unset(e->engine.data.output,
999 context); 999 context);
1000 if (obj->cur.map->surface) 1000 if (obj->map.surface)
1001 { 1001 {
1002 if (obj->cur.clipper) 1002 if (obj->cur.clipper)
1003 { 1003 {
@@ -1040,14 +1040,14 @@ evas_render_mapped(Evas *e, Evas_Object *obj, void *context, void *surface,
1040 (e->engine.data.output, context); 1040 (e->engine.data.output, context);
1041 obj->layer->evas->engine.func->image_map_draw 1041 obj->layer->evas->engine.func->image_map_draw
1042 (e->engine.data.output, context, surface, 1042 (e->engine.data.output, context, surface,
1043 obj->cur.map->surface, obj->spans, 1043 obj->map.surface, obj->spans,
1044 obj->cur.map->smooth, 0); 1044 obj->cur.map->smooth, 0);
1045 } 1045 }
1046 // FIXME: needs to cache these maps and 1046 // FIXME: needs to cache these maps and
1047 // keep them only rendering updates 1047 // keep them only rendering updates
1048 // obj->layer->evas->engine.func->image_map_surface_free 1048 // obj->layer->evas->engine.func->image_map_surface_free
1049 // (e->engine.data.output, obj->cur.map->surface); 1049 // (e->engine.data.output, obj->map.surface);
1050 // obj->cur.map->surface = NULL; 1050 // obj->map.surface = NULL;
1051 } 1051 }
1052 else 1052 else
1053 { 1053 {
@@ -1754,11 +1754,11 @@ evas_sync(Evas *e)
1754static void 1754static void
1755_evas_render_dump_map_surfaces(Evas_Object *obj) 1755_evas_render_dump_map_surfaces(Evas_Object *obj)
1756{ 1756{
1757 if ((obj->cur.map) && obj->cur.map->surface) 1757 if ((obj->cur.map) && obj->map.surface)
1758 { 1758 {
1759 obj->layer->evas->engine.func->image_map_surface_free 1759 obj->layer->evas->engine.func->image_map_surface_free
1760 (obj->layer->evas->engine.data.output, obj->cur.map->surface); 1760 (obj->layer->evas->engine.data.output, obj->map.surface);
1761 obj->cur.map->surface = NULL; 1761 obj->map.surface = NULL;
1762 } 1762 }
1763 1763
1764 if (obj->smart.smart) 1764 if (obj->smart.smart)
diff --git a/legacy/evas/src/lib/include/evas_private.h b/legacy/evas/src/lib/include/evas_private.h
index fdd24c7cb2..16c749b317 100644
--- a/legacy/evas/src/lib/include/evas_private.h
+++ b/legacy/evas/src/lib/include/evas_private.h
@@ -463,8 +463,8 @@ struct _Evas_Map
463 DATA32 magic; 463 DATA32 magic;
464 int count; // num of points 464 int count; // num of points
465 Evas_Coord_Rectangle normal_geometry; // bounding box of map geom actually 465 Evas_Coord_Rectangle normal_geometry; // bounding box of map geom actually
466 void *surface; // surface holding map if needed 466// void *surface; // surface holding map if needed
467 int surface_w, surface_h; // current surface w & h alloc 467// int surface_w, surface_h; // current surface w & h alloc
468 Evas_Coord mx, my; // mouse x, y after conversion to map space 468 Evas_Coord mx, my; // mouse x, y after conversion to map space
469 struct { 469 struct {
470 Evas_Coord px, py, z0, foc; 470 Evas_Coord px, py, z0, foc;
@@ -544,6 +544,11 @@ struct _Evas_Object
544 Eina_Bool parent_cached_surface : 1; 544 Eina_Bool parent_cached_surface : 1;
545 } cur, prev; 545 } cur, prev;
546 546
547 struct {
548 void *surface; // surface holding map if needed
549 int surface_w, surface_h; // current surface w & h alloc
550 } map;
551
547 Evas_Map *cache_map; 552 Evas_Map *cache_map;
548 char *name; 553 char *name;
549 554