X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f X-Recipient: geda-user AT delorie DOT com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=FxfKD1brohzLazJOxCbB0Fyn8g6fBOxfRtuhfHgopJg=; b=df9uEIyK2uqjxl5NCdlkqmeEc7XI1ZUTRiI+I0heKyc4Po1/bT5Ai/i9jKewooh6ql 03l1DT4zGfiRmJudnz8n5UjldjVwlz/rifMkgt0qPAGsYrj6hmbSxzC26xeXgOL+lTBk 7zCN9jonQZMhaTL14S6uAJUMB8dcaZkyEm4QXTc1XmPevdtYwZTyXepKfcJsKIC+pRf1 zE5T/HDmxbxWQAEk5oI00WgRWT7oglMPwIfi25IGHw6PtOK/ouQKq9wQgIXsexyte0+n PoSiDX5MOJn2QBa1at4oyGi4tSrg8ac7LXgubppPPyO4k3fPyIswQgoeOPnTlfZhdZ8k PWlQ== X-Received: by 10.180.219.106 with SMTP id pn10mr4430959wic.51.1411121789502; Fri, 19 Sep 2014 03:16:29 -0700 (PDT) Date: Fri, 19 Sep 2014 12:16:26 +0200 From: Riccardo Lucchese To: Gabriel Paubert Cc: geda-user AT delorie DOT com Subject: Re: [geda-user] [PATCH 08/43] Remove deprecated use of gtk_object_unref() Message-ID: <20140919101626.GA2461@rlp> References: <1411038398-10231-1-git-send-email-riccardo DOT lucchese AT gmail DOT com> <1411038398-10231-9-git-send-email-riccardo DOT lucchese AT gmail DOT com> <20140919092401 DOT GA20059 AT visitor2 DOT iram DOT es> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140919092401.GA20059@visitor2.iram.es> User-Agent: Mutt/1.5.23 (2014-03-12) Reply-To: geda-user AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: geda-user AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk Hi, On Fri, Sep 19, 2014 at 11:24:01AM +0200, Gabriel Paubert wrote: > Hi, > > On Thu, Sep 18, 2014 at 01:06:03PM +0200, Riccardo Lucchese wrote: > > Verbatim from Gtk+ 2 Reference Manual: "gtk_object_unref has been > > deprecated since version 2.12 and should not be used in newly-written > > code. Use g_object_unref() instead." > > --- > > gattrib/src/gtksheet_2_2.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/gattrib/src/gtksheet_2_2.c b/gattrib/src/gtksheet_2_2.c > > index 1df38f3..5bbad13 100644 > > --- a/gattrib/src/gtksheet_2_2.c > > +++ b/gattrib/src/gtksheet_2_2.c > > @@ -2381,7 +2381,7 @@ gtk_sheet_set_vadjustment (GtkSheet *sheet, > > if (sheet->vadjustment) > > { > > gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->vadjustment), sheet); > > - gtk_object_unref (GTK_OBJECT (sheet->vadjustment)); > > + g_object_unref(GTK_OBJECT(sheet->vadjustment)); > > } > > > > Actuall the cast to GTK_OBJECT becomes unnecessary since g_object_unref > takes a gpointer (which is a void*). > > With the cast it will complain in debugging mode if the object you pass in is > not a descendant of GtkObject but it won't help against passing in a GtkWidget > or any of its descendants. > > If you insist in keeping the casts, you should mention it specifically in the > commit message. > > I consider the casts to be more noise than anything else (and in practice they > have never triggered for my code), but someone might have a strong reason > to keep them. But for example in this case GTK_ADJUSTMENT(sheet->vadjustment) > would be more precise in debugging mode and generate the same code otherwise. > > This comment also applies to patch 43/43 and perhaps also to 23/43. Ok, I ran grep through a few projects (including geda-gaf) and indeed calling g_object_unref() without a cast is the preferred way. I will remove the unnecessary casts in v2. Thanks, Riccardo > > sheet->vadjustment = adjustment; > > @@ -2427,7 +2427,7 @@ gtk_sheet_set_hadjustment (GtkSheet *sheet, > > if (sheet->hadjustment) > > { > > gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->hadjustment), sheet); > > - gtk_object_unref (GTK_OBJECT (sheet->hadjustment)); > > + g_object_unref(GTK_OBJECT(sheet->hadjustment)); > > } > > > > sheet->hadjustment = adjustment; > > @@ -2538,13 +2538,13 @@ gtk_sheet_destroy (GtkObject * object) > > if (sheet->hadjustment) > > { > > gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->hadjustment), sheet); > > - gtk_object_unref (GTK_OBJECT (sheet->hadjustment)); > > + g_object_unref(GTK_OBJECT(sheet->hadjustment)); > > sheet->hadjustment = NULL; > > } > > if (sheet->vadjustment) > > { > > gtk_signal_disconnect_by_data (GTK_OBJECT (sheet->vadjustment), sheet); > > - gtk_object_unref (GTK_OBJECT (sheet->vadjustment)); > > + g_object_unref(GTK_OBJECT(sheet->vadjustment)); > > sheet->vadjustment = NULL; > > } > > Regards, > Gabriel