[gtk+] GdkWindow: fix conditional jump depends on uninitialized value error



commit 036c193fb2af3ced066a9abb338a34ffc1f52139
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Wed Sep 28 18:16:30 2011 -0400

    GdkWindow: fix conditional jump depends on uninitialized value error
    
    Those if() blocks don't have any reason being there, as x and y are not
    pointers. If the window is destroyed, just set the out values to zero
    and return.
    
    As seen in valgrind:
    
    ==3306== Conditional jump or move depends on uninitialised value(s)
    ==3306==    at 0x624C74F: gdk_window_get_root_coords (gdkwindow.c:6933)
    ==3306==    by 0x5E193C3: gtk_tooltip_show_tooltip (gtktooltip.c:1160)
    ==3306==    by 0x5E19C05: tooltip_popup_timeout (gtktooltip.c:1282)
    ==3306==    by 0x623B102: gdk_threads_dispatch (gdk.c:754)
    ==3306==    by 0x8592F3A: g_timeout_dispatch (gmain.c:3907)
    ==3306==    by 0x859174C: g_main_context_dispatch (gmain.c:2441)
    ==3306==    by 0x8591F47: g_main_context_iterate (gmain.c:3089)
    ==3306==    by 0x8592494: g_main_loop_run (gmain.c:3297)
    ==3306==    by 0x5D2E501: gtk_main (gtkmain.c:1362)
    ==3306==    by 0x5C5652F: gtk_application_run_mainloop
    (gtkapplication.c:115)
    ==3306==    by 0x7C47C9D: g_application_run (gapplication.c:1323)
    ==3306==    by 0x447B5F: main (nautilus-main.c:102)
    ==3306==  Uninitialised value was created by a stack allocation
    ==3306==    at 0x624D48A: gdk_window_get_device_position
    (gdkwindow.c:4952)

 gdk/gdkwindow.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 548330c..367f9f7 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -6930,10 +6930,8 @@ gdk_window_get_root_coords (GdkWindow *window,
 
   if (GDK_WINDOW_DESTROYED (window))
     {
-      if (x)
-	*root_x = x;
-      if (y)
-	*root_y = y;
+      *root_x = 0;
+      *root_y = 0;
       return;
     }
   



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]