summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2015-01-22 17:55:04 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2015-01-22 17:56:09 +0900
commit04ba5a3b994d0e513fefa2888e69ee6ffb919fc4 (patch)
treed045aa73c1e0b0990b5d0109012acf97216bdebc /src/modules
parentbc436ba95f74a75da8142a2de1b0ace23d0c9bf2 (diff)
Evas masking: Aaaand fix another series of memleaks
Don't inc-ref more than we can dec-ref.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/evas/engines/gl_generic/evas_engine.c23
-rw-r--r--src/modules/evas/engines/software_generic/evas_engine.c22
2 files changed, 31 insertions, 14 deletions
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c b/src/modules/evas/engines/gl_generic/evas_engine.c
index 66d98c48c6..198b6384a8 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -1727,9 +1727,15 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
1727{ 1727{
1728 RGBA_Draw_Context *ctx = context; 1728 RGBA_Draw_Context *ctx = context;
1729 Evas_GL_Image *im = surface; 1729 Evas_GL_Image *im = surface;
1730 Eina_Bool noinc = EINA_FALSE;
1730 1731
1731 if (ctx->clip.mask && ctx->clip.mask != surface) 1732 if (ctx->clip.mask)
1732 eng_context_clip_image_unset(data, context); 1733 {
1734 if (ctx->clip.mask != surface)
1735 eng_context_clip_image_unset(data, context);
1736 else
1737 noinc = EINA_TRUE;
1738 }
1733 1739
1734 ctx->clip.mask = surface; 1740 ctx->clip.mask = surface;
1735 ctx->clip.mask_x = x; 1741 ctx->clip.mask_x = x;
@@ -1738,18 +1744,21 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
1738 if (EINA_UNLIKELY(im && im->im)) 1744 if (EINA_UNLIKELY(im && im->im))
1739 { 1745 {
1740 // Unlikely to happen because masks are render surfaces. 1746 // Unlikely to happen because masks are render surfaces.
1747 if (!noinc)
1748 {
1741#ifdef EVAS_CSERVE2 1749#ifdef EVAS_CSERVE2
1742 if (evas_cserve2_use_get()) 1750 if (evas_cserve2_use_get())
1743 evas_cache2_image_ref(&im->im->cache_entry); 1751 evas_cache2_image_ref(&im->im->cache_entry);
1744 else 1752 else
1745#endif 1753#endif
1746 evas_cache_image_ref(&im->im->cache_entry); 1754 evas_cache_image_ref(&im->im->cache_entry);
1755 }
1747 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h, 1756 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
1748 x, y, im->im->cache_entry.w, im->im->cache_entry.h); 1757 x, y, im->im->cache_entry.w, im->im->cache_entry.h);
1749 } 1758 }
1750 else if (im) 1759 else if (im)
1751 { 1760 {
1752 im->references++; 1761 if (!noinc) im->references++;
1753 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h, 1762 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
1754 x, y, im->w, im->h); 1763 x, y, im->w, im->h);
1755 } 1764 }
diff --git a/src/modules/evas/engines/software_generic/evas_engine.c b/src/modules/evas/engines/software_generic/evas_engine.c
index 4ddf80a7f6..50b3e98729 100644
--- a/src/modules/evas/engines/software_generic/evas_engine.c
+++ b/src/modules/evas/engines/software_generic/evas_engine.c
@@ -440,9 +440,15 @@ static void
440eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface, int x, int y) 440eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface, int x, int y)
441{ 441{
442 RGBA_Draw_Context *ctx = context; 442 RGBA_Draw_Context *ctx = context;
443 Eina_Bool noinc = EINA_FALSE;
443 444
444 if (ctx->clip.mask && ctx->clip.mask != surface) 445 if (ctx->clip.mask)
445 eng_context_clip_image_unset(data, context); 446 {
447 if (ctx->clip.mask != surface)
448 eng_context_clip_image_unset(data, context);
449 else
450 noinc = EINA_TRUE;
451 }
446 452
447 ctx->clip.mask = surface; 453 ctx->clip.mask = surface;
448 ctx->clip.mask_x = x; 454 ctx->clip.mask_x = x;
@@ -451,13 +457,15 @@ eng_context_clip_image_set(void *data EINA_UNUSED, void *context, void *surface,
451 if (surface) 457 if (surface)
452 { 458 {
453 Image_Entry *ie = surface; 459 Image_Entry *ie = surface;
460 if (!noinc)
461 {
454#ifdef EVAS_CSERVE2 462#ifdef EVAS_CSERVE2
455 if (evas_cserve2_use_get()) 463 if (evas_cserve2_use_get())
456 evas_cache2_image_ref(ie); 464 evas_cache2_image_ref(ie);
457 else 465 else
458#endif 466#endif
459 evas_cache_image_ref(ie); 467 evas_cache_image_ref(ie);
460 468 }
461 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h, 469 RECTS_CLIP_TO_RECT(ctx->clip.x, ctx->clip.y, ctx->clip.w, ctx->clip.h,
462 x, y, ie->w, ie->h); 470 x, y, ie->w, ie->h);
463 } 471 }