From 997e5cb1b100c6af267b8121445db1db7e580d5f Mon Sep 17 00:00:00 2001 From: "Eric R. Schulz" Date: Thu, 18 Aug 2016 11:17:11 +0900 Subject: [PATCH 1/3] Fix GVariant leaks The expectation is that g_dbus_message_set_body() takes ownership of the GVariant, but this does not happen if the BusInputContext connection is NULL. Call g_variant_unref() in that case to free the memory. Alternatively, a GVariantBuilder could be used. BUG=https://github.com/ibus/ibus/pull/1872 R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/307050043 Patch from Eric R. Schulz . --- bus/inputcontext.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bus/inputcontext.c b/bus/inputcontext.c index 6c82e20..0612fac 100644 --- a/bus/inputcontext.c +++ b/bus/inputcontext.c @@ -673,8 +673,10 @@ bus_input_context_send_signal (BusInputContext *context, GVariant *parameters, GError **error) { - if (context->connection == NULL) + if (context->connection == NULL) { + g_variant_unref (parameters); return TRUE; + } GDBusMessage *message = g_dbus_message_new_signal (ibus_service_get_object_path ((IBusService *)context), interface_name, @@ -704,8 +706,10 @@ bus_input_context_emit_signal (BusInputContext *context, GVariant *parameters, GError **error) { - if (context->connection == NULL) + if (context->connection == NULL) { + g_variant_unref (parameters); return TRUE; + } return bus_input_context_send_signal (context, "org.freedesktop.IBus.InputContext", -- 2.7.4 From ceb6a9b47deaa898d8151606831669a7446ad382 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Tue, 6 Sep 2016 13:05:35 +0900 Subject: [PATCH 2/3] ui/gtk3: Fix radio buttons on Property Panel Use gtk_container_remove() instead g_object_unref() because if an widget has a parent, it's not destroyed and the signal is not sent to the parent since the parent was destroyed. R=shawn.p.huang@gmail.com Review URL: https://codereview.appspot.com/302650043 --- ui/gtk3/propertypanel.vala | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/gtk3/propertypanel.vala b/ui/gtk3/propertypanel.vala index 6d5fd81..ea960b8 100644 --- a/ui/gtk3/propertypanel.vala +++ b/ui/gtk3/propertypanel.vala @@ -2,9 +2,9 @@ * * ibus - The Input Bus * - * Copyright(c) 2013-2015 Red Hat, Inc. + * Copyright(c) 2013-2016 Red Hat, Inc. * Copyright(c) 2013-2015 Peng Huang - * Copyright(c) 2013-2015 Takao Fujiwara + * Copyright(c) 2013-2016 Takao Fujiwara * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -85,7 +85,7 @@ public class PropertyPanel : Gtk.Box { debug("set_properties()\n"); foreach (var item in m_items) - (item as Gtk.Widget).destroy(); + remove((item as Gtk.Widget)); m_items = {}; m_props = props; @@ -481,6 +481,8 @@ public class PropMenu : Gtk.Menu, IPropToolItem { public override void destroy() { m_parent_button = null; + foreach (var item in m_items) + remove((item as Gtk.Widget)); m_items = {}; base.destroy(); } @@ -739,7 +741,7 @@ public class PropMenuToolButton : PropToggleToolButton, IPropToolItem { m_menu = new PropMenu(prop); m_menu.deactivate.connect((m) => set_active(false)); - m_menu.property_activate.connect((w, k, s) => + m_menu.property_activate.connect((k, s) => property_activate(k, s)); base.set_property(prop); -- 2.7.4