summaryrefslogtreecommitdiff
path: root/src/lib/ethumb_client
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-07 15:47:04 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-07 15:47:59 +0900
commit44af3cb718a4354ef5e42b510daf29b5f6b3c282 (patch)
tree38fc5c57f3672f420587975cfe4c551a1de2b2a9 /src/lib/ethumb_client
parent7b018a9740924012e6a4f3ab9c13dfbea3780934 (diff)
ethumb - fix client free issue with pending dbus messages
this fixes T2769 @fix
Diffstat (limited to 'src/lib/ethumb_client')
-rw-r--r--src/lib/ethumb_client/ethumb_client.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/lib/ethumb_client/ethumb_client.c b/src/lib/ethumb_client/ethumb_client.c
index d20d893453..2bae0dcdd3 100644
--- a/src/lib/ethumb_client/ethumb_client.c
+++ b/src/lib/ethumb_client/ethumb_client.c
@@ -110,6 +110,7 @@ struct _Ethumb_Client
110 Eina_List *pending_add; 110 Eina_List *pending_add;
111 Eina_List *pending_remove; 111 Eina_List *pending_remove;
112 Eina_List *pending_gen; 112 Eina_List *pending_gen;
113 Eina_List *dbus_pending;
113 struct 114 struct
114 { 115 {
115 Ethumb_Client_Die_Cb cb; 116 Ethumb_Client_Die_Cb cb;
@@ -199,8 +200,11 @@ _ethumb_client_free(Ethumb_Client *client)
199{ 200{
200 void *data; 201 void *data;
201 Eldbus_Object *obj; 202 Eldbus_Object *obj;
203 Eldbus_Pending *pending;
202 204
203 if (client->invalid) return; 205 if (client->invalid) return;
206 EINA_LIST_FREE(client->dbus_pending, pending)
207 eldbus_pending_cancel(pending);
204 client->invalid = EINA_TRUE; 208 client->invalid = EINA_TRUE;
205 EINA_LIST_FREE(client->pending_add, data) 209 EINA_LIST_FREE(client->pending_add, data)
206 { 210 {
@@ -363,13 +367,14 @@ _ethumb_client_report_connect(Ethumb_Client *client, Eina_Bool success)
363} 367}
364 368
365static void 369static void
366_ethumb_client_new_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) 370_ethumb_client_new_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
367{ 371{
368 const char *errname, *errmsg; 372 const char *errname, *errmsg;
369 const char *opath; 373 const char *opath;
370 Ethumb_Client *client = data; 374 Ethumb_Client *client = data;
371 Eldbus_Object *obj; 375 Eldbus_Object *obj;
372 376
377 client->dbus_pending = eina_list_remove(client->dbus_pending, pending);
373 if (eldbus_message_error_get(msg, &errname, &errmsg)) 378 if (eldbus_message_error_get(msg, &errname, &errmsg))
374 { 379 {
375 ERR("Error: %s %s", errname, errmsg); 380 ERR("Error: %s %s", errname, errmsg);
@@ -404,10 +409,14 @@ static void
404_ethumb_client_call_new(Ethumb_Client *client) 409_ethumb_client_call_new(Ethumb_Client *client)
405{ 410{
406 Eldbus_Message *msg; 411 Eldbus_Message *msg;
412 Eldbus_Pending *pending;
407 msg = eldbus_message_method_call_new(_ethumb_dbus_bus_name, 413 msg = eldbus_message_method_call_new(_ethumb_dbus_bus_name,
408 _ethumb_dbus_path, 414 _ethumb_dbus_path,
409 _ethumb_dbus_interface, "new"); 415 _ethumb_dbus_interface, "new");
410 eldbus_connection_send(client->conn, msg, _ethumb_client_new_cb, client, -1); 416 pending = eldbus_connection_send(client->conn, msg,
417 _ethumb_client_new_cb, client, -1);
418 if (pending)
419 client->dbus_pending = eina_list_append(client->dbus_pending, pending);
411} 420}
412 421
413static void 422static void
@@ -676,10 +685,13 @@ ethumb_client_on_server_die_callback_set(Ethumb_Client *client, Ethumb_Client_Di
676 */ 685 */
677 686
678static void 687static void
679_ethumb_client_ethumb_setup_cb(void *data EINA_UNUSED, const Eldbus_Message *msg, Eldbus_Pending *pending EINA_UNUSED) 688_ethumb_client_ethumb_setup_cb(void *data, const Eldbus_Message *msg, Eldbus_Pending *pending)
680{ 689{
681 const char *errname, *errmsg; 690 const char *errname, *errmsg;
682 Eina_Bool result = 0; 691 Eina_Bool result = 0;
692 Ethumb_Client *client = data;
693
694 client->dbus_pending = eina_list_remove(client->dbus_pending, pending);
683 695
684 if (eldbus_message_error_get(msg, &errname, &errmsg)) 696 if (eldbus_message_error_get(msg, &errname, &errmsg))
685 { 697 {
@@ -773,6 +785,7 @@ ethumb_client_ethumb_setup(Ethumb_Client *client)
773 const char *directory, *category; 785 const char *directory, *category;
774 double video_time, video_start, video_interval; 786 double video_time, video_start, video_interval;
775 unsigned int video_ntimes, video_fps, document_page; 787 unsigned int video_ntimes, video_fps, document_page;
788 Eldbus_Pending *pending;
776 789
777 EINA_SAFETY_ON_NULL_RETURN(client); 790 EINA_SAFETY_ON_NULL_RETURN(client);
778 EINA_SAFETY_ON_FALSE_RETURN(client->connected); 791 EINA_SAFETY_ON_FALSE_RETURN(client->connected);
@@ -872,8 +885,10 @@ ethumb_client_ethumb_setup(Ethumb_Client *client)
872 885
873 eldbus_message_iter_container_close(main_iter, array); 886 eldbus_message_iter_container_close(main_iter, array);
874 887
875 eldbus_proxy_send(client->proxy, msg, _ethumb_client_ethumb_setup_cb, 888 pending = eldbus_proxy_send(client->proxy, msg,
876 client, -1); 889 _ethumb_client_ethumb_setup_cb, client, -1);
890 if (pending)
891 client->dbus_pending = eina_list_append(client->dbus_pending, pending);
877} 892}
878 893
879/** 894/**