stefan pushed a commit to branch efl-1.24.

http://git.enlightenment.org/core/efl.git/commit/?id=c904970ad3eba93aa7a59e912c54fa54bbfeb796

commit c904970ad3eba93aa7a59e912c54fa54bbfeb796
Author: Subhransu Mohanty <smohan...@gmail.com>
Date:   Wed Jun 3 13:03:39 2020 +0900

    evas/engine: Fix memory leak in generic cache.
    
    Summary:
    During shutdown we used to call engine_image_free() which was causing some 
deadlock.
    as we have evas_cache which takes care of freeing all the images we just 
have to
    delete the generic cache without freeing the image during shutdown.
    
    Reviewers: Hermet
    
    Reviewed By: Hermet
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D11915
---
 src/lib/evas/common/evas_common_generic_cache.c   | 13 +++++++++++--
 src/modules/evas/engines/gl_generic/evas_engine.c |  3 +--
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/lib/evas/common/evas_common_generic_cache.c 
b/src/lib/evas/common/evas_common_generic_cache.c
index ddb055deb2..4fc5a8bbac 100644
--- a/src/lib/evas/common/evas_common_generic_cache.c
+++ b/src/lib/evas/common/evas_common_generic_cache.c
@@ -14,8 +14,17 @@ generic_cache_new(void *user_data, Generic_Cache_Free func)
 EAPI void
 generic_cache_destroy(Generic_Cache *cache)
 {
-   generic_cache_dump(cache);
-   eina_hash_free(cache->hash);
+   Generic_Cache_Entry *entry;
+   if (cache)
+     {
+        EINA_LIST_FREE(cache->lru_list, entry)
+          {
+             free(entry);
+          }
+
+        eina_hash_free(cache->hash);
+        free(cache);          
+     }
 }
 
 EAPI void
diff --git a/src/modules/evas/engines/gl_generic/evas_engine.c 
b/src/modules/evas/engines/gl_generic/evas_engine.c
index d51a8ea1c7..8b9ef94d1b 100644
--- a/src/modules/evas/engines/gl_generic/evas_engine.c
+++ b/src/modules/evas/engines/gl_generic/evas_engine.c
@@ -167,8 +167,7 @@ eng_engine_free(void *engine)
    Render_Engine_GL_Generic *e = engine;
    Render_Output_GL_Generic *output;
 
-   //@FIXME this causes some deadlock while freeing the engine image.
-   //generic_cache_destroy(e->software.surface_cache);
+   generic_cache_destroy(e->software.surface_cache);
 
    EINA_LIST_FREE(e->software.outputs, output)
      ERR("Output %p not properly cleaned before engine destruction.", output);

-- 


Reply via email to