[Spice-devel] [PATCH spice-gtk 1/3] MainChannel: move task free from finalize to dispose
Fabiano FidĂȘncio
fidencio at redhat.com
Thu Oct 22 04:10:04 PDT 2015
On Thu, Oct 22, 2015 at 1:03 PM, Victor Toso <lists at victortoso.com> wrote:
> Hi,
>
> On Thu, Oct 22, 2015 at 10:06:04AM +0200, Fabiano FidĂȘncio wrote:
>> On Thu, Oct 22, 2015 at 9:13 AM, Victor Toso <lists at victortoso.com> wrote:
>> > Hi,
>> >
>> > On Wed, Oct 21, 2015 at 03:52:49PM -0500, Jonathon Jongsma wrote:
>> >> + if (c->file_xfer_tasks) {
>> >> + g_hash_table_unref(c->file_xfer_tasks);
>> >> + c->file_xfer_tasks = NULL;
>> >> + }
>> >> +
>> >
>> > g_clear_object(&c->file_xfer_tasks);
>>
>> No, please, it's wrong.
>> For GHashTable you must use g_clear_pointer() instead of
>> g_clear_object() and g_clear_pointer() is part of GLib since 2.34,
>> while we depend on 2.28.
>
> g_clear_object is 2.28, I checked in the manual before saying, just to
> be sure:
>
> https://developer.gnome.org/gobject/unstable/gobject-The-Base-Object-Type.html#g-clear-object
Sure it is.
OTOH, g_clear_object() works basically as g_clear_pointer(&object,
g_object_unref); and, in this case, it is not what we want, right?.
So, you would need to use g_clear_pointer(&object,
g_hash_table_unref)l and g_clear_pointer has been there since 2.34, as
I said.
Anyways, it doesn't matter that much as we have both on glib-compat,
as pointed by Pavel.
More information about the Spice-devel
mailing list