From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39991) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1CHC-00059U-LX for qemu-devel@nongnu.org; Fri, 13 May 2016 08:33:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b1CH9-0006kt-SO for qemu-devel@nongnu.org; Fri, 13 May 2016 08:33:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50796) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b1CH9-0006kf-Mb for qemu-devel@nongnu.org; Fri, 13 May 2016 08:33:03 -0400 From: Gerd Hoffmann Date: Fri, 13 May 2016 14:32:57 +0200 Message-Id: <1463142777-13040-18-git-send-email-kraxel@redhat.com> In-Reply-To: <1463142777-13040-1-git-send-email-kraxel@redhat.com> References: <1463142777-13040-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PULL v2 17/17] gtk: don't leak the GtkBorder with VTE 0.36 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alberto Garcia , Cole Robinson , Gerd Hoffmann From: Alberto Garcia When gtk_widget_style_get() is used to get the "inner-border" style property, it returns a copy of the GtkBorder which must be freed by the caller. This patch also fixes a warning about the unused 'padding' structure with VTE 0.36. Signed-off-by: Alberto Garcia Message-id: 1463127654-5171-1-git-send-email-berto@igalia.com Cc: Cole Robinson Cc: Gerd Hoffmann [ kraxel: adapted to changes in ui patch queue ] Signed-off-by: Gerd Hoffmann --- ui/gtk.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index a7d8a8b..7572cec 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -329,17 +329,22 @@ static void gd_update_geometry_hints(VirtualConsole *vc) #if defined(CONFIG_VTE) } else if (vc->type == GD_VC_VTE) { VteTerminal *term = VTE_TERMINAL(vc->vte.terminal); - GtkBorder *ib; + GtkBorder padding = { 0 }; #if VTE_CHECK_VERSION(0, 37, 0) - GtkBorder padding; gtk_style_context_get_padding( gtk_widget_get_style_context(vc->vte.terminal), gtk_widget_get_state_flags(vc->vte.terminal), &padding); - ib = &padding; #else - gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL); + { + GtkBorder *ib = NULL; + gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL); + if (ib) { + padding = *ib; + gtk_border_free(ib); + } + } #endif geo.width_inc = vte_terminal_get_char_width(term); @@ -352,12 +357,10 @@ static void gd_update_geometry_hints(VirtualConsole *vc) geo.min_height = geo.height_inc * VC_TERM_Y_MIN; mask |= GDK_HINT_MIN_SIZE; - if (ib) { - geo.base_width += ib->left + ib->right; - geo.base_height += ib->top + ib->bottom; - geo.min_width += ib->left + ib->right; - geo.min_height += ib->top + ib->bottom; - } + geo.base_width += padding.left + padding.right; + geo.base_height += padding.top + padding.bottom; + geo.min_width += padding.left + padding.right; + geo.min_height += padding.top + padding.bottom; geo_widget = vc->vte.terminal; #endif } -- 1.8.3.1