gadget: stringshare gadcon id instead of static buffer

A static char[128] returned from _gc_id_new is overwritten on every
call, so multiple gadget instances would alias the same id once gadcon
compares or stores it. eina_stringshare_add gives each instance its
own stable id.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
nemunaire 2026-04-29 11:25:56 +07:00
commit 47d70ab78d

View file

@ -259,10 +259,10 @@ _gc_icon(const E_Gadcon_Client_Class *cc EINA_UNUSED, Evas *evas)
static const char *
_gc_id_new(const E_Gadcon_Client_Class *cc)
{
static char buf[128];
char buf[128];
snprintf(buf, sizeof(buf), "%s.%d", cc->name,
eina_list_count(_instances) + 1);
return buf;
return eina_stringshare_add(buf);
}
static const E_Gadcon_Client_Class _gadcon_class =