forked from enlightenment/efl
Eina Debug: fix a bug resulting in registering opcodes twice
The opcodes registration request is sent directly in case the connection is already made. Otherwise, the request is waiting for the connection to be made by the dedicated thread (not the main loop). That's why the request can be sent by the two different threads at the same time, leading to send it twice. It means a callback for an opcode would be invoked twice everytime a request with this opcode is received. This patch fixes it by checking if the request has already been sent.
This commit is contained in:
parent
afb0add345
commit
0e947166aa
|
@ -120,6 +120,7 @@ typedef struct
|
||||||
const Eina_Debug_Opcode *ops;
|
const Eina_Debug_Opcode *ops;
|
||||||
Eina_Debug_Opcode_Status_Cb status_cb;
|
Eina_Debug_Opcode_Status_Cb status_cb;
|
||||||
void *status_data;
|
void *status_data;
|
||||||
|
Eina_Bool sent : 1;
|
||||||
} _opcode_reply_info;
|
} _opcode_reply_info;
|
||||||
|
|
||||||
struct _Eina_Debug_Session
|
struct _Eina_Debug_Session
|
||||||
|
@ -345,6 +346,13 @@ _opcodes_registration_send(Eina_Debug_Session *session,
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
int size = sizeof(uint64_t);
|
int size = sizeof(uint64_t);
|
||||||
|
Eina_Bool already_sent;
|
||||||
|
|
||||||
|
eina_spinlock_take(&_eina_debug_lock);
|
||||||
|
already_sent = info->sent;
|
||||||
|
info->sent = EINA_TRUE;
|
||||||
|
eina_spinlock_release(&_eina_debug_lock);
|
||||||
|
if (already_sent) return;
|
||||||
|
|
||||||
while (info->ops[count].opcode_name)
|
while (info->ops[count].opcode_name)
|
||||||
{
|
{
|
||||||
|
@ -625,6 +633,7 @@ eina_debug_opcodes_register(Eina_Debug_Session *session, const Eina_Debug_Opcode
|
||||||
info->ops = ops;
|
info->ops = ops;
|
||||||
info->status_cb = status_cb;
|
info->status_cb = status_cb;
|
||||||
info->status_data = data;
|
info->status_data = data;
|
||||||
|
info->sent = EINA_FALSE;
|
||||||
|
|
||||||
session->opcode_reply_infos = eina_list_append(
|
session->opcode_reply_infos = eina_list_append(
|
||||||
session->opcode_reply_infos, info);
|
session->opcode_reply_infos, info);
|
||||||
|
|
Loading…
Reference in New Issue