- Update HEAD.patch to make parallel dict build
- Update 1385349-segv-bus-proxy.patch
This commit is contained in:
Takao Fujiwara 2020-05-15 20:03:50 +09:00
parent 5be3a0c89f
commit c9bb32a521
3 changed files with 469 additions and 171 deletions

View File

@ -1,27 +1,17 @@
From fd19aaaa097e71e7589bdb3627971dc10bf3873e Mon Sep 17 00:00:00 2001
From 180ee9ce8d8f839db3e30803be5846c794416cbe Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 13 Feb 2020 19:33:32 +0900
Date: Fri, 15 May 2020 19:17:03 +0900
Subject: [PATCH] Fix SEGV in bus_panel_proxy_focus_in()
rhbz#1349148, rhbz#1385349
SEGV in BUS_IS_PANEL_PROXY() in bus_panel_proxy_focus_in()
Check if GDBusConnect is closed before bus_panel_proxy_new() is called.
rhbz#1350291 SEGV in BUS_IS_CONNECTION(skip_connection) in
bus_dbus_impl_dispatch_message_by_rule()
check if dbus_connection is closed in bus_dbus_impl_connection_filter_cb().
rhbz#1406699 SEGV in new_owner!=NULL in bus_dbus_impl_name_owner_changed()
which is called by bus_name_service_remove_owner()
If bus_connection_get_unique_name()==NULL, set new_owner="" in
bus_name_service_remove_owner()
rhbz#1767976 SEGV in assert(connection != NULL) in
bus_dbus_impl_connection_filter_cb()
call bus_connection_set_filter() in bus_dbus_impl_destroy().
rhbz#1432252 SEGV in old_owner!=NULL in bus_dbus_impl_name_owner_changed()
which is called by bus_name_service_set_primary_owner()
If bus_connection_get_unique_name()==NULL, set old_owner="" in
bus_name_service_set_primary_owner()
rhbz#1601577 SEGV in ibus_engine_desc_get_layout() in
rhbz#1601577 rhbz#1797726 SEGV in ibus_engine_desc_get_layout() in
bus_engine_proxy_new_internal()
WIP: Added a GError to get the error message to check why the SEGV happened.
@ -34,111 +24,35 @@ Do not call atexit functions in _sighandler().
rhbz#1795499 SEGV in ibus_bus_get_bus_address() because of no _bus->priv.
_changed_cb() should not be called after ibus_bus_destroy() is called.
BUG=rhbz#1349148
BUG=rhbz#1385349
rhbz#1771238 SEGV in assert(m_loop == null) in switcher.vala.
Grabbing keyboard could be failed and switcher received the keyboard
events and m_loop was not released.
rhbz#1797120 SEGV in assert(bus.is_connected()) in panel_binding_construct()
Check m_ibus in extension.vala:bus_name_acquired_cb()
BUG=rhbz#1350291
BUG=rhbz#1406699
BUG=rhbz#1432252
BUG=rhbz#1601577
BUG=rhbz#1663528
BUG=rhbz#1767691
BUG=rhbz#1795499
BUG=rhbz#1771238
BUG=rhbz#1767976
BUG=rhbz#1797120
---
bus/dbusimpl.c | 70 +++++++++++++++++++++++++++++++++++++++++------
bus/engineproxy.c | 9 +++++-
bus/ibusimpl.c | 21 ++++++++++++--
client/x11/main.c | 8 +++++-
src/ibusbus.c | 5 ++++
5 files changed, 100 insertions(+), 13 deletions(-)
bus/dbusimpl.c | 47 ++++++++++++++++++++++++---
bus/engineproxy.c | 11 ++++++-
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(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index b54ef817..fb38faf0 100644
index 59787a80..af2fbde2 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-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2019 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
@@ -344,6 +345,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
BusConnectionOwner *owner,
BusDBusImpl *dbus)
{
+ gboolean has_old_owner = FALSE;
+
g_assert (service != NULL);
g_assert (owner != NULL);
g_assert (dbus != NULL);
@@ -351,6 +354,13 @@ bus_name_service_set_primary_owner (BusNameService *service,
BusConnectionOwner *old = service->owners != NULL ?
(BusConnectionOwner *)service->owners->data : NULL;
+ /* rhbz#1432252 If bus_connection_get_unique_name() == NULL,
+ * "Hello" method is not received yet.
+ */
+ if (old != NULL && bus_connection_get_unique_name (old->conn) != NULL) {
+ has_old_owner = TRUE;
+ }
+
if (old != NULL) {
g_signal_emit (dbus,
dbus_signals[NAME_LOST],
@@ -370,7 +380,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
0,
owner->conn,
service->name,
- old != NULL ? bus_connection_get_unique_name (old->conn) : "",
+ has_old_owner ? bus_connection_get_unique_name (old->conn) :
+ "",
bus_connection_get_unique_name (owner->conn));
if (old != NULL && old->do_not_queue != 0) {
@@ -427,6 +438,7 @@ bus_name_service_remove_owner (BusNameService *service,
BusDBusImpl *dbus)
{
GSList *owners;
+ gboolean has_new_owner = FALSE;
g_assert (service != NULL);
g_assert (owner != NULL);
@@ -439,6 +451,13 @@ bus_name_service_remove_owner (BusNameService *service,
BusConnectionOwner *_new = NULL;
if (owners->next != NULL) {
_new = (BusConnectionOwner *)owners->next->data;
+ /* rhbz#1406699 If bus_connection_get_unique_name() == NULL,
+ * "Hello" method is not received yet.
+ */
+ if (_new != NULL &&
+ bus_connection_get_unique_name (_new->conn) != NULL) {
+ has_new_owner = TRUE;
+ }
}
if (dbus != NULL) {
@@ -447,7 +466,7 @@ bus_name_service_remove_owner (BusNameService *service,
0,
owner->conn,
service->name);
- if (_new != NULL) {
+ if (has_new_owner) {
g_signal_emit (dbus,
dbus_signals[NAME_ACQUIRED],
0,
@@ -460,7 +479,7 @@ bus_name_service_remove_owner (BusNameService *service,
_new != NULL ? _new->conn : NULL,
service->name,
bus_connection_get_unique_name (owner->conn),
- _new != NULL ? bus_connection_get_unique_name (_new->conn) : "");
+ has_new_owner ? bus_connection_get_unique_name (_new->conn) : "");
}
}
@@ -591,6 +610,7 @@ static void
@@ -610,6 +610,7 @@ static void
bus_dbus_impl_destroy (BusDBusImpl *dbus)
{
GList *p;
@ -146,7 +60,18 @@ index b54ef817..fb38faf0 100644
for (p = dbus->objects; p != NULL; p = p->next) {
IBusService *object = (IBusService *) p->data;
@@ -628,12 +648,39 @@ bus_dbus_impl_destroy (BusDBusImpl *dbus)
@@ -633,6 +634,10 @@ bus_dbus_impl_destroy (BusDBusImpl *dbus)
for (p = dbus->connections; p != NULL; p = p->next) {
BusConnection *connection = BUS_CONNECTION (p->data);
+ /* rhbz#1767976 Fix connection == NULL in
+ * bus_dbus_impl_connection_filter_cb()
+ */
+ bus_connection_set_filter (connection, NULL, NULL, NULL);
g_signal_handlers_disconnect_by_func (connection,
bus_dbus_impl_connection_destroy_cb, dbus);
ibus_object_destroy (IBUS_OBJECT (connection));
@@ -647,12 +652,39 @@ bus_dbus_impl_destroy (BusDBusImpl *dbus)
dbus->unique_names = NULL;
dbus->names = NULL;
@ -188,7 +113,7 @@ index b54ef817..fb38faf0 100644
/* FIXME destruct _lock and _queue members. */
IBUS_OBJECT_CLASS(bus_dbus_impl_parent_class)->destroy ((IBusObject *) dbus);
@@ -1464,13 +1511,20 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
@@ -1483,13 +1515,20 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
gboolean incoming,
gpointer user_data)
{
@ -212,10 +137,16 @@ index b54ef817..fb38faf0 100644
if (incoming) {
/* is incoming message */
diff --git a/bus/engineproxy.c b/bus/engineproxy.c
index 2d98995c..2176e0c9 100644
index 2d98995c..ec17900f 100644
--- a/bus/engineproxy.c
+++ b/bus/engineproxy.c
@@ -665,6 +665,7 @@ bus_engine_proxy_new_internal (const gchar *path,
@@ -660,11 +660,13 @@ bus_engine_proxy_g_signal (GDBusProxy *proxy,
g_return_if_reached ();
}
+#pragma GCC optimize ("O0")
static BusEngineProxy *
bus_engine_proxy_new_internal (const gchar *path,
IBusEngineDesc *desc,
GDBusConnection *connection)
{
@ -223,7 +154,7 @@ index 2d98995c..2176e0c9 100644
g_assert (path);
g_assert (IBUS_IS_ENGINE_DESC (desc));
g_assert (G_IS_DBUS_CONNECTION (connection));
@@ -673,7 +674,7 @@ bus_engine_proxy_new_internal (const gchar *path,
@@ -673,7 +675,7 @@ bus_engine_proxy_new_internal (const gchar *path,
BusEngineProxy *engine =
(BusEngineProxy *) g_initable_new (BUS_TYPE_ENGINE_PROXY,
NULL,
@ -232,7 +163,7 @@ index 2d98995c..2176e0c9 100644
"desc", desc,
"g-connection", connection,
"g-interface-name", IBUS_INTERFACE_ENGINE,
@@ -681,6 +682,12 @@ bus_engine_proxy_new_internal (const gchar *path,
@@ -681,12 +683,19 @@ bus_engine_proxy_new_internal (const gchar *path,
"g-default-timeout", g_gdbus_timeout,
"g-flags", flags,
NULL);
@ -245,60 +176,13 @@ index 2d98995c..2176e0c9 100644
const gchar *layout = ibus_engine_desc_get_layout (desc);
if (layout != NULL && layout[0] != '\0') {
engine->keymap = ibus_keymap_get (layout);
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 85761d30..f0dbccd1 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -464,13 +464,16 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
else if (!g_strcmp0 (name, IBUS_SERVICE_PANEL_EXTENSION_EMOJI))
panel_type = PANEL_TYPE_EXTENSION_EMOJI;
- if (panel_type != PANEL_TYPE_NONE) {
+ do {
+ if (panel_type == PANEL_TYPE_NONE)
+ break;
if (g_strcmp0 (new_name, "") != 0) {
/* a Panel process is started. */
BusConnection *connection;
BusInputContext *context = NULL;
BusPanelProxy **panel = (panel_type == PANEL_TYPE_PANEL) ?
&ibus->panel : &ibus->emoji_extension;
+ GDBusConnection *dbus_connection = NULL;
if (*panel != NULL) {
ibus_proxy_destroy ((IBusProxy *)(*panel));
@@ -479,9 +482,21 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
g_assert (*panel == NULL);
}
- connection = bus_dbus_impl_get_connection_by_name (BUS_DEFAULT_DBUS, new_name);
+ 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;
+ }
+
*panel = bus_panel_proxy_new (connection, panel_type);
if (panel_type == PANEL_TYPE_EXTENSION_EMOJI)
ibus->enable_emoji_extension = FALSE;
@@ -535,7 +550,7 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
}
}
}
- }
+ } while (0);
bus_ibus_impl_component_name_owner_changed (ibus, name, old_name, new_name);
}
return engine;
}
+#pragma GCC reset_options
typedef struct {
GTask *task;
diff --git a/client/x11/main.c b/client/x11/main.c
index c9ee174d..768b91f0 100644
--- a/client/x11/main.c
@ -341,6 +225,125 @@ index b7ffbb47..668c8a26 100644
g_object_unref (bus->priv->monitor);
bus->priv->monitor = NULL;
}
diff --git a/ui/gtk3/extension.vala b/ui/gtk3/extension.vala
index ea3cd464..57ed1357 100644
--- a/ui/gtk3/extension.vala
+++ b/ui/gtk3/extension.vala
@@ -73,6 +73,10 @@ class ExtensionGtk : Gtk.Application {
string signal_name,
Variant parameters) {
debug("signal_name = %s", signal_name);
+ /* rhbz#1797120 Fix assert(bus.is_connected()) in
+ * panel_binding_construct()
+ */
+ return_if_fail(m_bus.is_connected());
m_panel = new PanelBinding(m_bus, this);
m_panel.load_settings();
}
diff --git a/ui/gtk3/switcher.vala b/ui/gtk3/switcher.vala
index a4529c88..29a70dd5 100644
--- a/ui/gtk3/switcher.vala
+++ b/ui/gtk3/switcher.vala
@@ -140,8 +140,8 @@ class Switcher : Gtk.Window {
IBus.EngineDesc[] engines,
int index,
string input_context_path) {
- assert (m_loop == null);
- assert (index < engines.length);
+ assert(m_loop == null);
+ assert(index < engines.length);
m_is_running = true;
m_keyval = keyval;
@@ -198,16 +198,18 @@ class Switcher : Gtk.Window {
null,
event,
null);
- if (status != Gdk.GrabStatus.SUCCESS)
+ if (status != Gdk.GrabStatus.SUCCESS) {
warning("Grab keyboard failed! status = %d", status);
- status = seat.grab(get_window(),
- Gdk.SeatCapabilities.POINTER,
- true,
- null,
- event,
- null);
- if (status != Gdk.GrabStatus.SUCCESS)
- warning("Grab pointer failed! status = %d", status);
+ } else {
+ status = seat.grab(get_window(),
+ Gdk.SeatCapabilities.POINTER,
+ true,
+ null,
+ event,
+ null);
+ if (status != Gdk.GrabStatus.SUCCESS)
+ warning("Grab pointer failed! status = %d", status);
+ }
#else
Gdk.Device device = event.get_device();
if (device == null) {
@@ -243,30 +245,41 @@ class Switcher : Gtk.Window {
Gdk.EventMask.KEY_RELEASE_MASK,
null,
Gdk.CURRENT_TIME);
- if (status != Gdk.GrabStatus.SUCCESS)
+ if (status != Gdk.GrabStatus.SUCCESS) {
warning("Grab keyboard failed! status = %d", status);
- // Grab all pointer events
- status = pointer.grab(get_window(),
- Gdk.GrabOwnership.NONE,
- true,
- Gdk.EventMask.BUTTON_PRESS_MASK |
- Gdk.EventMask.BUTTON_RELEASE_MASK,
- null,
- Gdk.CURRENT_TIME);
- if (status != Gdk.GrabStatus.SUCCESS)
- warning("Grab pointer failed! status = %d", status);
+ } else {
+ // Grab all pointer events
+ status = pointer.grab(get_window(),
+ Gdk.GrabOwnership.NONE,
+ true,
+ Gdk.EventMask.BUTTON_PRESS_MASK |
+ Gdk.EventMask.BUTTON_RELEASE_MASK,
+ null,
+ Gdk.CURRENT_TIME);
+ if (status != Gdk.GrabStatus.SUCCESS)
+ warning("Grab pointer failed! status = %d", status);
+ }
#endif
- // Probably we can delete m_popup_delay_time in 1.6
- pointer.get_position_double(null,
- out m_mouse_init_x,
- out m_mouse_init_y);
- m_mouse_moved = false;
+ /* Fix RHBZ #1771238 assert(m_loop == null)
+ * Grabbing keyboard can be failed when the second Super-e is typed
+ * before Switcher dialog is focused. And m_loop could not be released
+ * if the failed Super-e would call m_loop.run() below and could not
+ * call key_release_event(). And m_loop == null would be false in the
+ * third Super-e.
+ */
+ if (status == Gdk.GrabStatus.SUCCESS) {
+ // Probably we can delete m_popup_delay_time in 1.6
+ pointer.get_position_double(null,
+ out m_mouse_init_x,
+ out m_mouse_init_y);
+ m_mouse_moved = false;
- m_loop = new GLib.MainLoop();
- m_loop.run();
- m_loop = null;
+ m_loop = new GLib.MainLoop();
+ m_loop.run();
+ m_loop = null;
+ }
#if VALA_0_34
seat.ungrab();
--
2.24.1

View File

@ -309,3 +309,291 @@ index f760fd5b..4232c549 100755
--
2.24.1
From 8c4125bc78ce3502b5aeb053e7029cc2594f83f2 Mon Sep 17 00:00:00 2001
From: Changwoo Ryu <cwryu@debian.org>
Date: Sun, 12 Apr 2020 05:28:15 +0900
Subject: [PATCH] src: Build the Emoji dictionaries in parallel
Instead of building Emoji dictionaries src/dicts/emoji-*.dict in sequence, a
pattern rule is specified for them. The make -jN option builds the
dictionaries in parallel.
The GNU make extensions like pattern rule and patsubst function are used for
it. But src/Makefile.am has had other GNU make extensions for a while, so
using more extensions should not make portability worse.
BUG=https://github.com/ibus/ibus/pull/2209
---
src/Makefile.am | 55 ++++++++++++++++++++++++-------------------------
1 file changed, 27 insertions(+), 28 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
index a8e3d07d..99de1ab7 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -246,42 +246,41 @@ if ENABLE_EMOJI_DICT
AM_CPPFLAGS += -DENABLE_EMOJI_DICT
dictdir = $(pkgdatadir)/dicts
-dict_DATA = dicts/emoji-en.dict
LANG_FILES = $(basename $(notdir $(wildcard $(EMOJI_ANNOTATION_DIR)/*.xml)))
+EMOJI_DICT_FILES = $(patsubst %,dicts/emoji-%.dict,$(LANG_FILES))
+dict_DATA = $(EMOJI_DICT_FILES)
noinst_PROGRAMS += emoji-parser
-dicts/emoji-en.dict: emoji-parser
+dicts/emoji-%.dict: emoji-parser
$(AM_V_at)if test x"$(LANG_FILES)" = x ; then \
echo "WARNING: Not found $(EMOJI_ANNOTATION_DIR)/en.xml" 1>&2; \
fi; \
- for f in $(LANG_FILES) ; do \
- if test -f dicts/emoji-$$f.dict; then \
- echo "Already exists dicts/emoji-$$f.dict"; \
- continue; \
- fi; \
- if test -f \
- "$(EMOJI_ANNOTATION_DIR)/../annotationsDerived/$$f.xml" ; then \
- xml_derived_option="--xml-derived $(EMOJI_ANNOTATION_DIR)/../annotationsDerived/$$f.xml"; \
+ if test -f $@; then \
+ echo "Already exists $@"; \
+ exit 0; \
+ fi; \
+ if test -f \
+ "$(EMOJI_ANNOTATION_DIR)/../annotationsDerived/$*.xml" ; then \
+ xml_derived_option="--xml-derived $(EMOJI_ANNOTATION_DIR)/../annotationsDerived/$*.xml"; \
plus_comment="derived"; \
- fi; \
- if test x"$$f" = xen ; then \
- $(builddir)/emoji-parser \
- --unicode-emoji-dir $(UNICODE_EMOJI_DIR) \
- --xml $(EMOJI_ANNOTATION_DIR)/$$f.xml \
- $$xml_derived_option \
- --xml-ascii $(top_srcdir)/data/annotations/en_ascii.xml \
- --out-category ibusemojigen.h \
- --out $@; \
- else \
- $(builddir)/emoji-parser \
- --unicode-emoji-dir $(UNICODE_EMOJI_DIR) \
- --xml $(EMOJI_ANNOTATION_DIR)/$$f.xml \
- $$xml_derived_option \
- --out dicts/emoji-$$f.dict; \
- fi; \
- echo "Generated $$plus_comment dicts/emoji-$$f.dict"; \
- done
+ fi; \
+ if test x"$*" = xen ; then \
+ $(builddir)/emoji-parser \
+ --unicode-emoji-dir $(UNICODE_EMOJI_DIR) \
+ --xml $(EMOJI_ANNOTATION_DIR)/$*.xml \
+ $$xml_derived_option \
+ --xml-ascii $(top_srcdir)/data/annotations/en_ascii.xml \
+ --out-category ibusemojigen.h \
+ --out $@; \
+ else \
+ $(builddir)/emoji-parser \
+ --unicode-emoji-dir $(UNICODE_EMOJI_DIR) \
+ --xml $(EMOJI_ANNOTATION_DIR)/$*.xml \
+ $$xml_derived_option \
+ --out $@; \
+ fi; \
+ echo "Generated $$plus_comment $@"
ibusemojigen.h: dicts/emoji-en.dict
$(NULL)
--
2.23.0.rc1
From 02105c4d486283e6b561181d9c934d4d23f2d65e Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 14 May 2020 15:48:34 +0900
Subject: [PATCH] bus: Fix SEGV in bus_panel_proxy_focus_in()
SEGV in BUS_IS_PANEL_PROXY() in bus_panel_proxy_focus_in()
Check if GDBusConnect is closed before bus_panel_proxy_new() is called.
BUG=rhbz#1349148
BUG=rhbz#1385349
---
bus/ibusimpl.c | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c
index 85761d30..e432e849 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -2,8 +2,8 @@
/* vim:set et sts=4: */
/* ibus - The Input Bus
* Copyright (C) 2008-2013 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2011-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2008-2019 Red Hat, Inc.
+ * Copyright (C) 2011-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2020 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
@@ -464,13 +464,16 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
else if (!g_strcmp0 (name, IBUS_SERVICE_PANEL_EXTENSION_EMOJI))
panel_type = PANEL_TYPE_EXTENSION_EMOJI;
- if (panel_type != PANEL_TYPE_NONE) {
+ do {
+ if (panel_type == PANEL_TYPE_NONE)
+ break;
if (g_strcmp0 (new_name, "") != 0) {
/* a Panel process is started. */
BusConnection *connection;
BusInputContext *context = NULL;
BusPanelProxy **panel = (panel_type == PANEL_TYPE_PANEL) ?
&ibus->panel : &ibus->emoji_extension;
+ GDBusConnection *dbus_connection = NULL;
if (*panel != NULL) {
ibus_proxy_destroy ((IBusProxy *)(*panel));
@@ -479,9 +482,21 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
g_assert (*panel == NULL);
}
- connection = bus_dbus_impl_get_connection_by_name (BUS_DEFAULT_DBUS, new_name);
+ 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;
+ }
+
*panel = bus_panel_proxy_new (connection, panel_type);
if (panel_type == PANEL_TYPE_EXTENSION_EMOJI)
ibus->enable_emoji_extension = FALSE;
@@ -535,7 +550,7 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
}
}
}
- }
+ } while (0);
bus_ibus_impl_component_name_owner_changed (ibus, name, old_name, new_name);
}
--
2.24.1
From f591381e3c892947ecaffe9131b9039ab9014498 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 14 May 2020 16:02:00 +0900
Subject: [PATCH] bus: Fix SEGV in bus_dbus_impl_name_owner_changed()
rhbz#1406699 SEGV in new_owner!=NULL in bus_dbus_impl_name_owner_changed()
which is called by bus_name_service_remove_owner()
If bus_connection_get_unique_name()==NULL, set new_owner="" in
bus_name_service_remove_owner()
rhbz#1432252 SEGV in old_owner!=NULL in bus_dbus_impl_name_owner_changed()
which is called by bus_name_service_set_primary_owner()
If bus_connection_get_unique_name()==NULL, set old_owner="" in
bus_name_service_set_primary_owner()
BUG=rhbz#1406699
BUG=rhbz#1432252
---
bus/dbusimpl.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index b54ef817..59787a80 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-2020 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2008-2020 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
@@ -344,6 +345,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
BusConnectionOwner *owner,
BusDBusImpl *dbus)
{
+ gboolean has_old_owner = FALSE;
+
g_assert (service != NULL);
g_assert (owner != NULL);
g_assert (dbus != NULL);
@@ -351,6 +354,13 @@ bus_name_service_set_primary_owner (BusNameService *service,
BusConnectionOwner *old = service->owners != NULL ?
(BusConnectionOwner *)service->owners->data : NULL;
+ /* rhbz#1432252 If bus_connection_get_unique_name() == NULL,
+ * "Hello" method is not received yet.
+ */
+ if (old != NULL && bus_connection_get_unique_name (old->conn) != NULL) {
+ has_old_owner = TRUE;
+ }
+
if (old != NULL) {
g_signal_emit (dbus,
dbus_signals[NAME_LOST],
@@ -370,7 +380,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
0,
owner->conn,
service->name,
- old != NULL ? bus_connection_get_unique_name (old->conn) : "",
+ has_old_owner ? bus_connection_get_unique_name (old->conn) :
+ "",
bus_connection_get_unique_name (owner->conn));
if (old != NULL && old->do_not_queue != 0) {
@@ -427,6 +438,7 @@ bus_name_service_remove_owner (BusNameService *service,
BusDBusImpl *dbus)
{
GSList *owners;
+ gboolean has_new_owner = FALSE;
g_assert (service != NULL);
g_assert (owner != NULL);
@@ -439,6 +451,13 @@ bus_name_service_remove_owner (BusNameService *service,
BusConnectionOwner *_new = NULL;
if (owners->next != NULL) {
_new = (BusConnectionOwner *)owners->next->data;
+ /* rhbz#1406699 If bus_connection_get_unique_name() == NULL,
+ * "Hello" method is not received yet.
+ */
+ if (_new != NULL &&
+ bus_connection_get_unique_name (_new->conn) != NULL) {
+ has_new_owner = TRUE;
+ }
}
if (dbus != NULL) {
@@ -447,7 +466,7 @@ bus_name_service_remove_owner (BusNameService *service,
0,
owner->conn,
service->name);
- if (_new != NULL) {
+ if (has_new_owner) {
g_signal_emit (dbus,
dbus_signals[NAME_ACQUIRED],
0,
@@ -460,7 +479,7 @@ bus_name_service_remove_owner (BusNameService *service,
_new != NULL ? _new->conn : NULL,
service->name,
bus_connection_get_unique_name (owner->conn),
- _new != NULL ? bus_connection_get_unique_name (_new->conn) : "");
+ has_new_owner ? bus_connection_get_unique_name (_new->conn) : "");
}
}
--
2.24.1

View File

@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.22
Release: 5%{?dist}
Release: 6%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -269,6 +269,7 @@ fi
#autoreconf -f -i -v
#make -C ui/gtk3 maintainer-clean-generic
#make -C tools maintainer-clean-generic
autoreconf -f -i -v
%configure \
--disable-static \
--enable-gtk2 \
@ -290,6 +291,7 @@ fi
--enable-install-tests \
%{nil}
make -C ui/gtk3 maintainer-clean-generic
%make_build
%install
@ -461,6 +463,11 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* 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
- Resolves #1767976 #1601577 #1771238 #1797120
* Wed Apr 22 2020 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.22-5
- Update ibus-desktop-testing-runner for su command