112 lines
3.9 KiB
Diff
112 lines
3.9 KiB
Diff
From ddb7cb30f10b1d1e40ae4b6c46583941545412d8 Mon Sep 17 00:00:00 2001
|
|
From: fujiwarat <takao.fujiwara1@gmail.com>
|
|
Date: Wed, 26 Jul 2017 21:41:13 +0900
|
|
Subject: [PATCH] bus: Fix SEGV in bus_panel_proxy_focus_in()
|
|
|
|
BUG=rhbz#1349148
|
|
BUG=rhbz#1385349
|
|
BUG=rhbz#1350291
|
|
---
|
|
bus/dbusimpl.c | 14 +++++++++++---
|
|
bus/ibusimpl.c | 22 +++++++++++++++++++---
|
|
2 files changed, 30 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
|
|
index b54ef81..4a60391 100644
|
|
--- a/bus/dbusimpl.c
|
|
+++ b/bus/dbusimpl.c
|
|
@@ -2,7 +2,8 @@
|
|
/* vim:set et sts=4: */
|
|
/* ibus - The Input Bus
|
|
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
|
|
- * Copyright (C) 2008-2013 Red Hat, Inc.
|
|
+ * Copyright (C) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
+ * Copyright (C) 2008-2017 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
@@ -1464,13 +1465,20 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
|
|
gboolean incoming,
|
|
gpointer user_data)
|
|
{
|
|
+ BusDBusImpl *dbus;
|
|
+ BusConnection *connection;
|
|
+
|
|
g_assert (G_IS_DBUS_CONNECTION (dbus_connection));
|
|
g_assert (G_IS_DBUS_MESSAGE (message));
|
|
g_assert (BUS_IS_DBUS_IMPL (user_data));
|
|
|
|
- BusDBusImpl *dbus = (BusDBusImpl *) user_data;
|
|
- BusConnection *connection = bus_connection_lookup (dbus_connection);
|
|
+ if (g_dbus_connection_is_closed (dbus_connection))
|
|
+ return NULL;
|
|
+
|
|
+ dbus = (BusDBusImpl *) user_data;
|
|
+ connection = bus_connection_lookup (dbus_connection);
|
|
g_assert (connection != NULL);
|
|
+ g_assert (BUS_IS_CONNECTION (connection));
|
|
|
|
if (incoming) {
|
|
/* is incoming message */
|
|
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
|
|
index f99307a..2d43ff6 100644
|
|
--- a/bus/ibusimpl.c
|
|
+++ b/bus/ibusimpl.c
|
|
@@ -2,7 +2,8 @@
|
|
/* vim:set et sts=4: */
|
|
/* ibus - The Input Bus
|
|
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
|
|
- * Copyright (C) 2008-2013 Red Hat, Inc.
|
|
+ * Copyright (C) 2015-2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
|
|
+ * Copyright (C) 2008-2017 Red Hat, Inc.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
@@ -323,11 +324,14 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
|
|
g_assert (new_name != NULL);
|
|
g_assert (BUS_IS_IBUS_IMPL (ibus));
|
|
|
|
- if (g_strcmp0 (name, IBUS_SERVICE_PANEL) == 0) {
|
|
+ do {
|
|
+ if (g_strcmp0 (name, IBUS_SERVICE_PANEL) != 0)
|
|
+ break;
|
|
if (g_strcmp0 (new_name, "") != 0) {
|
|
/* a Panel process is started. */
|
|
BusConnection *connection;
|
|
BusInputContext *context = NULL;
|
|
+ GDBusConnection *dbus_connection = NULL;
|
|
|
|
if (ibus->panel != NULL) {
|
|
ibus_proxy_destroy ((IBusProxy *) ibus->panel);
|
|
@@ -338,6 +342,18 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
|
|
connection = bus_dbus_impl_get_connection_by_name (BUS_DEFAULT_DBUS, new_name);
|
|
g_return_if_fail (connection != NULL);
|
|
|
|
+ dbus_connection = bus_connection_get_dbus_connection (connection);
|
|
+
|
|
+ /* rhbz#1349148 rhbz#1385349
|
|
+ * Avoid SEGV of BUS_IS_PANEL_PROXY (ibus->panel)
|
|
+ * This function is called during destroying the connection
|
|
+ * in this case? */
|
|
+ if (dbus_connection == NULL ||
|
|
+ g_dbus_connection_is_closed (dbus_connection)) {
|
|
+ new_name = "";
|
|
+ break;
|
|
+ }
|
|
+
|
|
ibus->panel = bus_panel_proxy_new (connection);
|
|
|
|
g_signal_connect (ibus->panel,
|
|
@@ -366,7 +382,7 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
+ } while (0);
|
|
|
|
bus_ibus_impl_component_name_owner_changed (ibus, name, old_name, new_name);
|
|
}
|
|
--
|
|
2.9.3
|
|
|