delorie.com/archives/browse.cgi   search  
Mail Archives: geda-user/2014/09/19/05:25:14

X-Authentication-Warning: delorie.com: mail set sender to geda-user-bounces using -f
X-Recipient: geda-user AT delorie DOT com
X-Envelope-From: paubert AT iram DOT es
Date: Fri, 19 Sep 2014 11:24:01 +0200
From: Gabriel Paubert <paubert AT iram DOT es>
To: geda-user AT delorie DOT com
Cc: Riccardo Lucchese <riccardo DOT lucchese AT gmail DOT com>
Subject: Re: [geda-user] [PATCH 08/43] Remove deprecated use of
gtk_object_unref()
Message-ID: <20140919092401.GA20059@visitor2.iram.es>
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>
MIME-Version: 1.0
In-Reply-To: <1411038398-10231-9-git-send-email-riccardo.lucchese@gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Spamina-Bogosity: Unsure
X-Spamina-Spam-Score: -0.2 (/)
X-Spamina-Spam-Report: Content analysis details: (-0.2 points)
pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
0.8 BAYES_50 BODY: Bayes spam probability is 40 to 60%
[score: 0.4726]
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

	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.

>    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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019