Subject: bug#9901: closed (Re: bug#9901: xg_win_to_widget uninitialized access)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 30 Oct 2011 17:35:01 +0000

Your bug report

#9901: xg_win_to_widget uninitialized access

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
9901: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9901
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#9901: xg_win_to_widget uninitialized access
From: Jan Djärv <[email-masked]>
To: Dan Nicolaescu <[email-masked]>
Cc: [email-masked]
Date: Sun, 30 Oct 2011 18:32:16 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Fixed.

	Jan D.

29 okt 2011 kl. 03:59 skrev Dan Nicolaescu:

> valgrind gives a warning for an uninitialized access in
> xg_win_to_widget for the gtk_get_event_widget call.
> 
> 
> if (gdkwin)
>    {
>      GdkEvent event;
>      event.any.window = gdkwin;
>      gwdesc = gtk_get_event_widget (&event);
>    }
> 
> gtk_get_event_widget is (in gtk3):
> 
> GtkWidget*
> gtk_get_event_widget (GdkEvent *event)
> {
>  GtkWidget *widget;
>  gpointer widget_ptr;
> 
>  widget = NULL;
>  if (event && event->any.window &&
>      (event->type == GDK_DESTROY || !gdk_window_is_destroyed
>  (event->any.window)))
>    {
>      gdk_window_get_user_data (event->any.window, &widget_ptr);
>      widget = widget_ptr;
>    }
> 
>  return widget;
> }
> 
> so indeed event->type is uninitialized.
> 
> 
> 

Subject: xg_win_to_widget uninitialized access
From: Dan Nicolaescu <[email-masked]>
To: [email-masked]
Date: Fri, 28 Oct 2011 21:59:02 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

valgrind gives a warning for an uninitialized access in
xg_win_to_widget for the gtk_get_event_widget call.

 if (gdkwin)
    {
      GdkEvent event;
      event.any.window = gdkwin;
      gwdesc = gtk_get_event_widget (&event);
    }

gtk_get_event_widget is (in gtk3):

GtkWidget*
gtk_get_event_widget (GdkEvent *event)
{
  GtkWidget *widget;
  gpointer widget_ptr;

  widget = NULL;
  if (event && event->any.window &&
      (event->type == GDK_DESTROY || !gdk_window_is_destroyed
  (event->any.window)))
    {
      gdk_window_get_user_data (event->any.window, &widget_ptr);
      widget = widget_ptr;
    }

  return widget;
}

so indeed event->type is uninitialized.