This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enventor.

View the commit online.

commit 8c89becfdb3fb1ec0f7d50fb76606072d7fb7227
Author: Thanatermesis <[email protected]>
AuthorDate: Mon Feb 23 15:56:52 2026 -0500

    fix: Resolve memory leaks, logic errors, and UI callback issues in menu
    
    I have identified several issues in src/bin/menu.c:
    
    1 Memory Leak: In fileselector_save_done_cb, when a file extension is missing and eina_stringshare_printf is used, a new stringshare is created but never deleted if the
    function returns early due to a save failure.
    2 Logic Error: In fileselector_save_done_cb, main_file was always being set to EINA_TRUE regardless of the condition.
    3 Potential Crash/Memory Leak: In menu_term, the last_accessed_path stringshare is never deleted, leading to a memory leak.
    4 UI Consistency: In menu_exit, a callback is added with evas_object_smart_callback_priority_add but never removed, which could lead to multiple callbacks or behavior issues
    if the exit is cancelled and later re-triggered.
    
    Here are the fixes:
---
 src/bin/menu.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/bin/menu.c b/src/bin/menu.c
index a754a3b..4728acb 100644
--- a/src/bin/menu.c
+++ b/src/bin/menu.c
@@ -339,15 +339,17 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
         selected = eina_stringshare_printf("%s.edc", selected);
         is_edc = EINA_TRUE;
      }
+   else
+     {
+        eina_stringshare_ref(selected);
+     }
 
    Enventor_Object *enventor = base_enventor_get();
    Enventor_Item *it = file_mgr_focused_item_get();
 
    if (is_edc)
      {
-        Eina_Bool main_file;
-        if (file_mgr_main_item_get() == it) main_file = EINA_TRUE;
-        else main_file = EINA_TRUE;
+        Eina_Bool main_file = (file_mgr_main_item_get() == it);
 
         //Update config path if main file.
         if (main_file)
@@ -387,6 +389,7 @@ fileselector_save_done_cb(void *data, Evas_Object *obj, void *event_info)
    file_mgr_reset();
    fileselector_close(md);
    menu_close(md);
+   eina_stringshare_del(selected);
 }
 
 static void
@@ -633,6 +636,7 @@ void
 menu_term(void)
 {
    menu_data *md = g_md;
+   eina_stringshare_del(md->last_accessed_path);
    free(md);
 }
 
@@ -723,6 +727,9 @@ enventor_ctxpopup_dismissed_cb(void *data, Evas_Object *obj EINA_UNUSED,
    menu_data *md = data;
    EINA_SAFETY_ON_NULL_RETURN(md);
 
+   evas_object_smart_callback_del(obj, "ctxpopup,dismissed",
+                                  enventor_ctxpopup_dismissed_cb);
+
    warning_open(md, exit_yes_btn_cb, exit_save_btn_cb);
 }
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to