Resolves #1797726 bus_engine_proxy_new_internal() SIGTRAP

This commit is contained in:
Takao Fujiwara 2020-05-15 21:49:02 +09:00
parent c9bb32a521
commit d8723bd2ff
2 changed files with 72 additions and 15 deletions

View File

@ -1,6 +1,6 @@
From 180ee9ce8d8f839db3e30803be5846c794416cbe Mon Sep 17 00:00:00 2001
From 023d50db40912e4f7ee333543e05995a9c730bae Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 15 May 2020 19:17:03 +0900
Date: Fri, 15 May 2020 21:44:16 +0900
Subject: [PATCH] Fix SEGV in bus_panel_proxy_focus_in()
rhbz#1350291 SEGV in BUS_IS_CONNECTION(skip_connection) in
@ -41,12 +41,12 @@ BUG=rhbz#1767976
BUG=rhbz#1797120
---
bus/dbusimpl.c | 47 ++++++++++++++++++++++++---
bus/engineproxy.c | 11 ++++++-
bus/engineproxy.c | 51 ++++++++++++++++++++++-------
client/x11/main.c | 8 ++++-
src/ibusbus.c | 5 +++
ui/gtk3/extension.vala | 4 +++
ui/gtk3/switcher.vala | 73 +++++++++++++++++++++++++-----------------
6 files changed, 112 insertions(+), 36 deletions(-)
6 files changed, 141 insertions(+), 47 deletions(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index 59787a80..af2fbde2 100644
@ -137,10 +137,10 @@ index 59787a80..af2fbde2 100644
if (incoming) {
/* is incoming message */
diff --git a/bus/engineproxy.c b/bus/engineproxy.c
index 2d98995c..ec17900f 100644
index 2d98995c..bbbe5532 100644
--- a/bus/engineproxy.c
+++ b/bus/engineproxy.c
@@ -660,11 +660,13 @@ bus_engine_proxy_g_signal (GDBusProxy *proxy,
@@ -660,20 +660,33 @@ bus_engine_proxy_g_signal (GDBusProxy *proxy,
g_return_if_reached ();
}
@ -148,29 +148,44 @@ index 2d98995c..ec17900f 100644
static BusEngineProxy *
bus_engine_proxy_new_internal (const gchar *path,
IBusEngineDesc *desc,
GDBusConnection *connection)
- GDBusConnection *connection)
+ GDBusConnection *connection,
+ GError **error)
{
+ GError *error = NULL;
+ GDBusProxyFlags flags;
+ BusEngineProxy *engine;
+
g_assert (path);
g_assert (IBUS_IS_ENGINE_DESC (desc));
g_assert (G_IS_DBUS_CONNECTION (connection));
@@ -673,7 +675,7 @@ bus_engine_proxy_new_internal (const gchar *path,
BusEngineProxy *engine =
+ g_assert (error && *error == NULL);
- GDBusProxyFlags flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START;
- BusEngineProxy *engine =
+ /* rhbz#1601577 engine == NULL if connection is closed. */
+ if (g_dbus_connection_is_closed (connection)) {
+ *error = g_error_new (G_DBUS_ERROR,
+ G_DBUS_ERROR_FAILED,
+ "Connection is closed.");
+ return NULL;
+ }
+ flags = G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START;
+ engine =
(BusEngineProxy *) g_initable_new (BUS_TYPE_ENGINE_PROXY,
NULL,
- NULL,
+ &error,
+ error,
"desc", desc,
"g-connection", connection,
"g-interface-name", IBUS_INTERFACE_ENGINE,
@@ -681,12 +683,19 @@ bus_engine_proxy_new_internal (const gchar *path,
@@ -681,12 +694,19 @@ bus_engine_proxy_new_internal (const gchar *path,
"g-default-timeout", g_gdbus_timeout,
"g-flags", flags,
NULL);
+ /* FIXME: rhbz#1601577 */
+ if (error) {
+ if (!engine) {
+ /* show abrt local variable */
+ gchar *message = g_strdup (error->message);
+ gchar *message = g_strdup ((*error)->message);
+ g_error ("%s", message);
+ }
const gchar *layout = ibus_engine_desc_get_layout (desc);
@ -183,6 +198,45 @@ index 2d98995c..ec17900f 100644
typedef struct {
GTask *task;
@@ -748,23 +768,30 @@ create_engine_ready_cb (BusFactoryProxy *factory,
GAsyncResult *res,
EngineProxyNewData *data)
{
+ GError *error = NULL;
+ gchar *path;
+ BusEngineProxy *engine;
+
g_return_if_fail (data->task != NULL);
- GError *error = NULL;
- gchar *path = bus_factory_proxy_create_engine_finish (factory,
- res,
- &error);
+ path = bus_factory_proxy_create_engine_finish (factory, res, &error);
if (path == NULL) {
g_task_return_error (data->task, error);
engine_proxy_new_data_free (data);
return;
}
- BusEngineProxy *engine =
- bus_engine_proxy_new_internal (path,
- data->desc,
- g_dbus_proxy_get_connection ((GDBusProxy *)data->factory));
+ engine = bus_engine_proxy_new_internal (
+ path,
+ data->desc,
+ g_dbus_proxy_get_connection ((GDBusProxy *)data->factory),
+ &error);
g_free (path);
+ if (!engine) {
+ g_task_return_error (data->task, error);
+ engine_proxy_new_data_free (data);
+ return;
+ }
/* FIXME: set destroy callback ? */
g_task_return_pointer (data->task, engine, NULL);
diff --git a/client/x11/main.c b/client/x11/main.c
index c9ee174d..768b91f0 100644
--- a/client/x11/main.c

View File

@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.22
Release: 6%{?dist}
Release: 7%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -463,6 +463,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Fri May 15 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-7
- Resolves #1797726 bus_engine_proxy_new_internal() SIGTRAP
* Fri May 15 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-6
- Update HEAD.patch to make parallel dict build
- Update 1385349-segv-bus-proxy.patch