[gtk+/gtk-3-16] GtkWindow: Fix a use-after-free



commit 6ea7c290a34d27a2f125f2e93147d2f2fcbc1634
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Jul 17 19:19:24 2015 -0400

    GtkWindow: Fix a use-after-free
    
    We were printing a string in a warning after freeing it.
    Also, fix an x/y typo that might cause popovers to be
    mispositioned.

 gtk/gtkwindow.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 52ea51c..941b87b 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6359,7 +6359,7 @@ popover_get_rect (GtkWindowPopover      *popover,
         {
           rect->y = popover->rect.y + popover->rect.height;
 
-          if (rect->y + rect->height < win_alloc.x + win_alloc.height &&
+          if (rect->y + rect->height < win_alloc.y + win_alloc.height &&
               gtk_widget_get_vexpand (popover->widget))
             rect->height = win_alloc.y + win_alloc.height - rect->y;
         }
@@ -11054,14 +11054,16 @@ gtk_window_activate_menubar (GtkWindow   *window,
     return FALSE;
 
   gtk_accelerator_parse (accel, &keyval, &mods);
-  g_free (accel);
 
   if (keyval == 0)
     {
       g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
+      g_free (accel);
       return FALSE;
     }
 
+  g_free (accel);
+
   /* FIXME this is wrong, needs to be in the global accel resolution
    * thing, to properly consider i18n etc., but that probably requires
    * AccelGroup changes etc.


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