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:
parent
0ab9561d2b
commit
47d70ab78d
1 changed files with 2 additions and 2 deletions
|
|
@ -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 =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue