diff options
author | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 14:39:30 +0100 |
---|---|---|
committer | Xavier Claessens <xclaesse@gmail.com> | 2011-11-16 15:56:47 +0100 |
commit | 769a97c2ed9e6cbfda656a65483f6142423adc36 (patch) | |
tree | 2fd5a84dd6c4a41d4e4e61d37780d65a630fa72f /src/media-channel.c | |
parent | dfccd984ac6c694a689c1f224efb4f4e2b27e01c (diff) |
Use _unref instead of _free _destroy when possible.unref
Replace g_(ptr_)array_free (foo, TRUE) and g_hash_table_destroy
with respectively g_(ptr_)array_unref (foo) and g_hash_table_unref.
I used this command to generate this patch:
for f in `find -name "*.c"`; do sed -i $f -re 's/g_ptr_array_free \(([^ ,]+), TRUE\)/g_ptr_array_unref \(\1\)/'; done
See Danielle's blog for explanation of possible bug _free can do:
http://blogs.gnome.org/danni/2011/11/16/mistakes-with-g_value_set_boxed/
Diffstat (limited to 'src/media-channel.c')
-rw-r--r-- | src/media-channel.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/media-channel.c b/src/media-channel.c index 136c785c5..d57ed4012 100644 --- a/src/media-channel.c +++ b/src/media-channel.c @@ -978,7 +978,7 @@ gabble_media_channel_dispose (GObject *object) { g_ptr_array_foreach (priv->delayed_request_streams, (GFunc) destroy_request, NULL); - g_ptr_array_free (priv->delayed_request_streams, TRUE); + g_ptr_array_unref (priv->delayed_request_streams); priv->delayed_request_streams = NULL; } @@ -995,7 +995,7 @@ gabble_media_channel_dispose (GObject *object) * removed when the call ended. */ g_assert (priv->streams->len == 0); - g_ptr_array_free (priv->streams, TRUE); + g_ptr_array_unref (priv->streams); priv->streams = NULL; if (G_OBJECT_CLASS (gabble_media_channel_parent_class)->dispose) @@ -1160,7 +1160,7 @@ gabble_media_channel_get_session_handlers (TpSvcChannelInterfaceMediaSignalling tp_svc_channel_interface_media_signalling_return_from_get_session_handlers ( context, ret); g_ptr_array_foreach (ret, (GFunc) g_value_array_free, NULL); - g_ptr_array_free (ret, TRUE); + g_ptr_array_unref (ret); } /** @@ -1253,7 +1253,7 @@ gabble_media_channel_list_streams (TpSvcChannelTypeStreamedMedia *iface, tp_svc_channel_type_streamed_media_return_from_list_streams (context, ret); g_ptr_array_foreach (ret, (GFunc) g_value_array_free, NULL); - g_ptr_array_free (ret, TRUE); + g_ptr_array_unref (ret); } @@ -1389,7 +1389,7 @@ gabble_media_channel_remove_streams (TpSvcChannelTypeStreamedMedia *iface, } OUT: - g_ptr_array_free (stream_objs, TRUE); + g_ptr_array_unref (stream_objs); if (error) { @@ -1549,7 +1549,7 @@ pending_stream_request_maybe_satisfy (PendingStreamRequest *p, p->succeeded_cb (p->context, ret); g_ptr_array_foreach (ret, (GFunc) g_value_array_free, NULL); - g_ptr_array_free (ret, TRUE); + g_ptr_array_unref (ret); p->context = NULL; return TRUE; } @@ -1797,7 +1797,7 @@ destroy_request (struct _delayed_request_streams_ctx *ctx, g_error_free (error); } - g_array_free (ctx->types, TRUE); + g_array_unref (ctx->types); g_slice_free (struct _delayed_request_streams_ctx, ctx); } @@ -1895,7 +1895,7 @@ media_channel_request_streams (GabbleMediaChannel *self, DEBUG ("no streams to request"); succeeded_cb (context, empty); - g_ptr_array_free (empty, TRUE); + g_ptr_array_unref (empty); return; } @@ -1941,7 +1941,7 @@ media_channel_request_streams (GabbleMediaChannel *self, context); priv->pending_stream_requests = g_list_prepend (priv->pending_stream_requests, psr); - g_ptr_array_free (contents, TRUE); + g_ptr_array_unref (contents); /* signal acceptance */ gabble_jingle_session_accept (priv->session); @@ -2041,7 +2041,7 @@ gabble_media_channel_request_initial_streams (GabbleMediaChannel *chan, media_channel_request_streams (chan, priv->initial_peer, types, succeeded_cb, failed_cb, user_data); - g_array_free (types, TRUE); + g_array_unref (types); } static gboolean @@ -2440,7 +2440,7 @@ session_terminated_cb (GabbleJingleSession *session, /* All the streams should have closed. */ g_assert (priv->streams->len == 0); - g_ptr_array_free (tmp, TRUE); + g_ptr_array_unref (tmp); } /* remove the session */ @@ -3070,7 +3070,7 @@ gabble_media_channel_error (TpSvcMediaSessionHandler *iface, gabble_media_stream_error (stream, errno, message, NULL); } - g_ptr_array_free (tmp, TRUE); + g_ptr_array_unref (tmp); tp_svc_media_session_handler_return_from_error (context); } |