raster pushed a commit to branch master.

commit d573133ff8d865608a4839104de7e17ad507ae6d
Author: Carsten Haitzler (Rasterman) <[email protected]>
Date:   Tue Aug 27 17:20:25 2013 +0900

    fix ethumb client segv's i've been hunting...
---
 src/lib/ethumb_client/ethumb_client.c | 31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/src/lib/ethumb_client/ethumb_client.c 
b/src/lib/ethumb_client/ethumb_client.c
index b21ddf4..0d86962 100644
--- a/src/lib/ethumb_client/ethumb_client.c
+++ b/src/lib/ethumb_client/ethumb_client.c
@@ -205,11 +205,16 @@ _ethumb_client_free(Ethumb_Client *client)
    EINA_LIST_FREE(client->pending_add, data)
      {
         struct _ethumb_pending_add *pending = data;
-        pending->client = NULL;
         if (pending->pending_call)
-          eldbus_pending_cancel(pending->pending_call);
+          {
+             eldbus_pending_cancel(pending->pending_call);
+             pending->client = NULL;
+          }
         else
-          free(pending);
+          {
+             pending->client = NULL;
+             free(pending);
+          }
      }
 
    EINA_LIST_FREE(client->pending_gen, data)
@@ -229,11 +234,16 @@ _ethumb_client_free(Ethumb_Client *client)
         struct _ethumb_pending_remove *pending = data;
         if (pending->free_data)
           pending->free_data(pending->data);
-        pending->client = NULL;
         if (pending->pending_call)
-          eldbus_pending_cancel(pending->pending_call);
+          {
+             eldbus_pending_cancel(pending->pending_call);
+             pending->client = NULL;
+          }
         else
-          free(pending);
+          {
+             pending->client = NULL;
+             free(pending);
+          }
      }
 
    if (client->old_ethumb_conf)
@@ -937,7 +947,7 @@ _ethumb_client_queue_add_cb(void *data, const 
Eldbus_Message *msg, Eldbus_Pendin
    pending->pending_call = NULL;
    if (!client) goto end;
    client->pending_add = eina_list_remove(client->pending_add, pending);
-
+   
    if (eldbus_message_error_get(msg, &errname, &errmsg))
      {
         ERR("Error: %s %s", errname, errmsg);
@@ -950,6 +960,7 @@ _ethumb_client_queue_add_cb(void *data, const 
Eldbus_Message *msg, Eldbus_Pendin
         goto end;
      }
 
+   
    generating = calloc(1, sizeof(*generating));
    generating->id = id;
    generating->file = pending->file;
@@ -1002,10 +1013,11 @@ _ethumb_client_queue_add(Ethumb_Client *client, const 
char *file, const char *ke
    _ethumb_client_dbus_append_bytearray(main_itr, thumb);
    _ethumb_client_dbus_append_bytearray(main_itr, thumb_key);
 
+   client->pending_add = eina_list_append(client->pending_add, pending);
+   
    pending->pending_call = eldbus_proxy_send(client->proxy, msg,
                                              _ethumb_client_queue_add_cb,
                                              pending, -1);
-   client->pending_add = eina_list_append(client->pending_add, pending);
 
    return pending->id;
 }
@@ -1099,7 +1111,8 @@ ethumb_client_generate_cancel(Ethumb_Client *client, int 
id, Ethumb_Client_Gener
              l = l->next;
              continue;
           }
-        eldbus_pending_cancel(pending_add->pending_call);
+        if (pending_add->pending_call)
+          eldbus_pending_cancel(pending_add->pending_call);
         pending_add->pending_call = NULL;
         found = 1;
         break;

-- 

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk

Reply via email to