diff options
author | Cosimo Cecchi <cosimo.cecchi@collabora.co.uk> | 2009-05-05 21:02:23 +0800 |
---|---|---|
committer | Cosimo Cecchi <cosimoc@gnome.org> | 2009-06-01 23:47:39 +0800 |
commit | 04cc954b2551b7c6c622a630bfc54d55edbe81ab (patch) | |
tree | 5d89e7fb195c38088bb992a7ad289d4b7853f6c7 /libempathy | |
parent | b026e9345b2249d2d5d1217ea79315ffa43151cc (diff) | |
download | gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.tar gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.tar.gz gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.tar.bz2 gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.tar.lz gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.tar.xz gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.tar.zst gsoc2013-empathy-04cc954b2551b7c6c622a630bfc54d55edbe81ab.zip |
Properly ref/unref the request table
Destroy the request table early, and keep a reference when passing it to
the dispatcher.
Also, don't cancel the nonexistant EmpathyTpFile when stopping hashing.
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-ft-handler.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index ad497de47..e5c18cbdb 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -410,6 +410,10 @@ ft_handler_create_channel_cb (EmpathyDispatchOperation *operation, DEBUG ("Dispatcher create channel CB"); + /* we can destroy now the request */ + g_hash_table_destroy (priv->request); + priv->request = NULL; + if (my_error == NULL) { g_cancellable_set_error_if_cancelled (priv->cancellable, &my_error); @@ -447,8 +451,9 @@ ft_handler_push_to_dispatcher (EmpathyFTHandler *handler) dispatcher = empathy_dispatcher_dup_singleton (); account = empathy_contact_get_account (priv->contact); - empathy_dispatcher_create_channel (dispatcher, account, priv->request, - ft_handler_create_channel_cb, handler); + /* I want to own a reference to the request, and destroy it later */ + empathy_dispatcher_create_channel (dispatcher, account, + g_hash_table_ref (priv->request), ft_handler_create_channel_cb, handler); g_object_unref (dispatcher); } @@ -606,8 +611,6 @@ hash_job_async_read_cb (GObject *source, gssize bytes_read; GError *error = NULL; - DEBUG ("Reading a chunk for hashing."); - bytes_read = g_input_stream_read_finish (hash_data->stream, res, &error); if (error != NULL) { @@ -952,9 +955,13 @@ empathy_ft_handler_cancel_transfer (EmpathyFTHandler *handler) priv = GET_PRIV (handler); - g_return_if_fail (priv->tpfile != NULL); - - empathy_tp_file_cancel (priv->tpfile); + /* if we don't have an EmpathyTpFile, we are hashing, so + * we can just cancel the GCancellable to stop it. + */ + if (priv->tpfile == NULL) + g_cancellable_cancel (priv->cancellable); + else + empathy_tp_file_cancel (priv->tpfile); } void |