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/muc-factory.c | |
parent | dfccd984ac6c694a689c1f224efb4f4e2b27e01c (diff) | |
download | telepathy-gabble-769a97c2ed9e6cbfda656a65483f6142423adc36.tar.gz |
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/muc-factory.c')
-rw-r--r-- | src/muc-factory.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/muc-factory.c b/src/muc-factory.c index c8275a25e..e2bb31cc2 100644 --- a/src/muc-factory.c +++ b/src/muc-factory.c @@ -161,7 +161,7 @@ gabble_muc_factory_dispose (GObject *object) g_hash_table_foreach (priv->disco_requests, cancel_disco_request, priv->conn->disco); - g_hash_table_destroy (priv->disco_requests); + g_hash_table_unref (priv->disco_requests); if (G_OBJECT_CLASS (gabble_muc_factory_parent_class)->dispose) G_OBJECT_CLASS (gabble_muc_factory_parent_class)->dispose (object); @@ -335,7 +335,7 @@ muc_ready_cb (GabbleMucChannel *text_chan, tp_channel_manager_emit_new_channels (fac, channels); - g_hash_table_destroy (channels); + g_hash_table_unref (channels); } g_hash_table_remove (priv->tubes_needed_for_tube, tubes_chan); @@ -504,7 +504,7 @@ new_muc_channel (GabbleMucFactory *fac, g_hash_table_insert (priv->text_channels, GUINT_TO_POINTER (handle), chan); g_free (object_path); - g_ptr_array_free (initial_channels_array, TRUE); + g_ptr_array_unref (initial_channels_array); g_array_unref (initial_handles); if (_gabble_muc_channel_is_ready (chan)) @@ -892,9 +892,9 @@ gabble_muc_factory_close_all (GabbleMucFactory *self) g_hash_table_foreach_steal (priv->queued_requests, cancel_queued_requests, self); - tp_clear_pointer (&priv->queued_requests, g_hash_table_destroy); - tp_clear_pointer (&priv->text_needed_for_tubes, g_hash_table_destroy); - tp_clear_pointer (&priv->tubes_needed_for_tube, g_hash_table_destroy); + tp_clear_pointer (&priv->queued_requests, g_hash_table_unref); + tp_clear_pointer (&priv->text_needed_for_tubes, g_hash_table_unref); + tp_clear_pointer (&priv->tubes_needed_for_tube, g_hash_table_unref); /* Use a temporary variable because we don't want * muc_channel_closed_cb or tubes_channel_closed_cb to remove the channel @@ -911,7 +911,7 @@ gabble_muc_factory_close_all (GabbleMucFactory *self) while (g_hash_table_iter_next (&iter, NULL, &chan)) gabble_muc_channel_teardown (GABBLE_MUC_CHANNEL (chan)); - g_hash_table_destroy (tmp); + g_hash_table_unref (tmp); } if (priv->message_cb != NULL) @@ -1171,7 +1171,7 @@ gabble_muc_factory_type_foreach_channel_class (GType type, gabble_media_factory_call_channel_allowed_properties (), user_data); - g_hash_table_destroy (table); + g_hash_table_unref (table); } /* return TRUE if the text_channel associated is ready */ @@ -1535,8 +1535,8 @@ out: if (room != 0) tp_handle_unref (room_handles, room); - g_hash_table_destroy (final_channels); - g_array_free (final_handles, TRUE); + g_hash_table_unref (final_channels); + g_array_unref (final_handles); g_free (final_ids); tp_handle_set_destroy (handles); @@ -1656,7 +1656,7 @@ handle_tube_channel_request (GabbleMucFactory *self, g_hash_table_insert (channels, new_channel, request_tokens); tp_channel_manager_emit_new_channels (self, channels); - g_hash_table_destroy (channels); + g_hash_table_unref (channels); g_slist_free (request_tokens); } else |