Resolves: #1470673 Replace assert with warning for .XCompose

- Update APIs for Hangul preedit in Flatpak
- Fix Atom and Slack for Flatpak
- Resolves: #1663528 Check if the mutex is not unlocked before the clear
This commit is contained in:
Takao Fujiwara 2019-01-29 18:28:31 +09:00
parent 98deeedf28
commit 0e0ffba4d2
3 changed files with 865 additions and 27 deletions

View File

@ -1,7 +1,32 @@
From 865b204f1c06b782cf7b4a479b358e76f4b3dfee Mon Sep 17 00:00:00 2001
From 988059d40c9b6cffc3039a6d7623dc73672b0ad5 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 17 Jul 2018 13:39:30 +0900
Subject: [PATCH] bus: Fix SEGV in bus_panel_proxy_focus_in()
Date: Tue, 29 Jan 2019 17:49:47 +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#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
bus_engine_proxy_new_internal()
WIP: Added a GError to get the error message to check why the SEGV happened.
rhbz#1663528 SEGV in g_mutex_clear() in bus_dbus_impl_destroy()
If the mutex is not unlocked, g_mutex_clear() causes assert.
BUG=rhbz#1349148
BUG=rhbz#1385349
@ -9,14 +34,15 @@ BUG=rhbz#1350291
BUG=rhbz#1406699
BUG=rhbz#1432252
BUG=rhbz#1601577
BUG=rhbz#1663528
---
bus/dbusimpl.c | 38 ++++++++++++++++++++++++++++++++------
bus/engineproxy.c | 5 ++++-
bus/ibusimpl.c | 21 ++++++++++++++++++---
3 files changed, 54 insertions(+), 10 deletions(-)
bus/dbusimpl.c | 236 +++++++++++++++++++++++++++++++++++++---------
bus/engineproxy.c | 9 +-
bus/ibusimpl.c | 21 ++++-
3 files changed, 215 insertions(+), 51 deletions(-)
diff --git a/bus/dbusimpl.c b/bus/dbusimpl.c
index b54ef817..e4dd8683 100644
index b54ef817..2eb5565d 100644
--- a/bus/dbusimpl.c
+++ b/bus/dbusimpl.c
@@ -2,7 +2,8 @@
@ -24,12 +50,121 @@ index b54ef817..e4dd8683 100644
/* 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.
+ * 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,
@@ -43,13 +44,23 @@ enum {
static guint dbus_signals[LAST_SIGNAL] = { 0 };
+/* rhbz#1663528 Check the value of is_locked before g_mutex_clear()
+ * because if the mutex is not unlocked, g_mutex_clear() causes assert.
+ */
+typedef struct {
+ GMutex lock;
+ gboolean is_locked;
+ GList *queue;
+} BusDBusQueue;
+
struct _BusDBusImpl {
IBusService parent;
/* instance members */
/* a map from a unique bus name (e.g. ":1.0") to a BusConnection. */
GHashTable *unique_names;
- /* a map from a requested well-known name (e.g. "org.freedesktop.IBus.Panel") to a BusNameService. */
+ /* a map from a requested well-known name (e.g. "org.freedesktop.IBus.Panel"
+ *) to a BusNameService. */
GHashTable *names;
/* a list of IBusService objects. */
GList *objects;
@@ -60,11 +71,8 @@ struct _BusDBusImpl {
/* a serial number used to generate a unique name of a bus. */
guint id;
- GMutex dispatch_lock;
- GList *dispatch_queue;
-
- GMutex forward_lock;
- GList *forward_queue;
+ BusDBusQueue *dispatch;
+ BusDBusQueue *forward;
/* a list of BusMethodCall to be used to reply when services are
really available */
@@ -255,6 +263,69 @@ static const gchar introspection_xml[] =
" </interface>"
"</node>";
+/* Use the functions instead of the macros because the macros would caused
+ * optimized g_mutex_unlock() with GCC9. This also has a dummy return variable
+ * to prevent the reverse order of safe_lock() and safe_unlock() with the
+ * optimization in Fedora builds.
+ */
+static gboolean
+bus_dbus_queue_mutex_safe_lock(BusDBusQueue *queue,
+ GDBusMessage *message,
+ int line,
+ const gchar *func) {
+ int tout = 0;
+ while (G_UNLIKELY ((queue)->is_locked)) {
+ g_usleep (1);
+ tout++;
+ if (tout > 60)
+ break;
+ }
+ if (G_UNLIKELY (tout)) {
+ const gchar *path = g_dbus_message_get_path (message);
+ const gchar *interface = g_dbus_message_get_interface (message);
+ const gchar *member = g_dbus_message_get_member (message);
+ const gchar *sender = g_dbus_message_get_sender (message);
+ const gchar *dest = g_dbus_message_get_destination (message);
+ g_warning ("%d:%s:(%s:%s:%s:%s:%s):%d: was locked.",
+ line, func,
+ path ? path : "(null)",
+ interface ? interface : "(null)",
+ member ? member : "(null)",
+ sender ? sender : "(null)",
+ dest ? dest : "(null)",
+ tout);
+ }
+ (queue)->is_locked = TRUE;
+ g_mutex_lock (&((queue)->lock));
+ return TRUE;
+}
+
+static gboolean
+bus_dbus_queue_mutex_safe_unlock(BusDBusQueue *queue,
+ GDBusMessage *message,
+ int line,
+ const gchar *func) {
+ if (G_LIKELY ((queue)->is_locked)) {
+ g_mutex_unlock (&((queue)->lock));
+ } else {
+ const gchar *path = g_dbus_message_get_path (message);
+ const gchar *interface = g_dbus_message_get_interface (message);
+ const gchar *member = g_dbus_message_get_member (message);
+ const gchar *sender = g_dbus_message_get_sender (message);
+ const gchar *dest = g_dbus_message_get_destination (message);
+ g_warning ("%d:%s:(%s:%s:%s:%s:%s):" \
+ " was unlocked by bus_dbus_impl_destroy",
+ line, func,
+ path ? path : "(null)",
+ interface ? interface : "(null)",
+ member ? member : "(null)",
+ sender ? sender : "(null)",
+ dest ? dest : "(null)");
+ }
+ (queue)->is_locked = FALSE;
+ return FALSE;
+}
+
static void
bus_connection_owner_set_flags (BusConnectionOwner *owner,
guint32 flags)
@@ -344,6 +415,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
BusConnectionOwner *owner,
BusDBusImpl *dbus)
{
@ -38,7 +173,7 @@ index b54ef817..e4dd8683 100644
g_assert (service != NULL);
g_assert (owner != NULL);
g_assert (dbus != NULL);
@@ -351,6 +354,13 @@ bus_name_service_set_primary_owner (BusNameService *service,
@@ -351,6 +424,13 @@ bus_name_service_set_primary_owner (BusNameService *service,
BusConnectionOwner *old = service->owners != NULL ?
(BusConnectionOwner *)service->owners->data : NULL;
@ -52,7 +187,7 @@ index b54ef817..e4dd8683 100644
if (old != NULL) {
g_signal_emit (dbus,
dbus_signals[NAME_LOST],
@@ -370,7 +380,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
@@ -370,7 +450,8 @@ bus_name_service_set_primary_owner (BusNameService *service,
0,
owner->conn,
service->name,
@ -62,7 +197,7 @@ index b54ef817..e4dd8683 100644
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,
@@ -427,6 +508,7 @@ bus_name_service_remove_owner (BusNameService *service,
BusDBusImpl *dbus)
{
GSList *owners;
@ -70,7 +205,7 @@ index b54ef817..e4dd8683 100644
g_assert (service != NULL);
g_assert (owner != NULL);
@@ -439,6 +451,13 @@ bus_name_service_remove_owner (BusNameService *service,
@@ -439,6 +521,13 @@ bus_name_service_remove_owner (BusNameService *service,
BusConnectionOwner *_new = NULL;
if (owners->next != NULL) {
_new = (BusConnectionOwner *)owners->next->data;
@ -84,7 +219,7 @@ index b54ef817..e4dd8683 100644
}
if (dbus != NULL) {
@@ -447,7 +466,7 @@ bus_name_service_remove_owner (BusNameService *service,
@@ -447,7 +536,7 @@ bus_name_service_remove_owner (BusNameService *service,
0,
owner->conn,
service->name);
@ -93,7 +228,7 @@ index b54ef817..e4dd8683 100644
g_signal_emit (dbus,
dbus_signals[NAME_ACQUIRED],
0,
@@ -460,7 +479,7 @@ bus_name_service_remove_owner (BusNameService *service,
@@ -460,7 +549,7 @@ bus_name_service_remove_owner (BusNameService *service,
_new != NULL ? _new->conn : NULL,
service->name,
bus_connection_get_unique_name (owner->conn),
@ -102,7 +237,47 @@ index b54ef817..e4dd8683 100644
}
}
@@ -1464,13 +1483,20 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
@@ -581,8 +670,10 @@ bus_dbus_impl_init (BusDBusImpl *dbus)
NULL,
(GDestroyNotify) bus_name_service_free);
- g_mutex_init (&dbus->dispatch_lock);
- g_mutex_init (&dbus->forward_lock);
+ dbus->dispatch = g_slice_new0 (BusDBusQueue);
+ g_mutex_init (&dbus->dispatch->lock);
+ dbus->forward = g_slice_new0 (BusDBusQueue);
+ g_mutex_init (&dbus->forward->lock);
/* other members are automatically zero-initialized. */
}
@@ -632,8 +723,24 @@ bus_dbus_impl_destroy (BusDBusImpl *dbus)
(GDestroyNotify) bus_method_call_free);
dbus->start_service_calls = NULL;
- g_mutex_clear (&dbus->dispatch_lock);
- g_mutex_clear (&dbus->forward_lock);
+ /* rhbz#1663528 Check the value of is_locked before g_mutex_clear()
+ * because if the mutex is not unlocked, g_mutex_clear() causes assert.
+ */
+ if (G_UNLIKELY (dbus->dispatch->is_locked)) {
+ g_mutex_unlock (&dbus->dispatch->lock);
+ g_warning ("dbus->dispatch was not unlocked");
+ dbus->dispatch->is_locked = FALSE;
+ }
+ g_mutex_clear (&dbus->dispatch->lock);
+ g_slice_free (BusDBusQueue, dbus->dispatch);
+
+ if (G_UNLIKELY (dbus->forward->is_locked)) {
+ g_mutex_unlock (&dbus->forward->lock);
+ g_warning ("dbus->forward was not unlocked");
+ dbus->forward->is_locked = FALSE;
+ }
+ g_mutex_clear (&dbus->forward->lock);
+ g_slice_free (BusDBusQueue, dbus->forward);
/* FIXME destruct _lock and _queue members. */
IBUS_OBJECT_CLASS(bus_dbus_impl_parent_class)->destroy ((IBusObject *) dbus);
@@ -1464,13 +1571,20 @@ bus_dbus_impl_connection_filter_cb (GDBusConnection *dbus_connection,
gboolean incoming,
gpointer user_data)
{
@ -125,8 +300,147 @@ index b54ef817..e4dd8683 100644
if (incoming) {
/* is incoming message */
@@ -1721,18 +1835,24 @@ struct _BusForwardData {
/**
* bus_dbus_impl_forward_message_ible_cb:
*
- * Process the first element of the dbus->forward_queue. The first element is forwarded by g_dbus_connection_send_message.
+ * Process the first element of the dbus->forward->queue. The first element is
+ * forwarded by g_dbus_connection_send_message.
*/
static gboolean
bus_dbus_impl_forward_message_idle_cb (BusDBusImpl *dbus)
{
- g_return_val_if_fail (dbus->forward_queue != NULL, FALSE);
-
- g_mutex_lock (&dbus->forward_lock);
- BusForwardData *data = (BusForwardData *) dbus->forward_queue->data;
- dbus->forward_queue = g_list_delete_link (dbus->forward_queue, dbus->forward_queue);
- gboolean has_message = (dbus->forward_queue != NULL);
- g_mutex_unlock (&dbus->forward_lock);
+ g_return_val_if_fail (dbus->forward->queue != NULL, FALSE);
+
+ BusForwardData *data = (BusForwardData *) dbus->forward->queue->data;
+ dbus->forward->is_locked = bus_dbus_queue_mutex_safe_lock (
+ dbus->forward, data->message,
+ __LINE__, G_STRFUNC);
+ dbus->forward->queue = g_list_delete_link (dbus->forward->queue,
+ dbus->forward->queue);
+ gboolean has_message = (dbus->forward->queue != NULL);
+ dbus->forward->is_locked = bus_dbus_queue_mutex_safe_unlock (
+ dbus->forward, data->message,
+ __LINE__, G_STRFUNC);
do {
const gchar *destination = g_dbus_message_get_destination (data->message);
@@ -1791,18 +1911,25 @@ bus_dbus_impl_forward_message (BusDBusImpl *dbus,
if (G_UNLIKELY (IBUS_OBJECT_DESTROYED (dbus)))
return;
- /* FIXME the check above might not be sufficient. dbus object could be destroyed in the main thread right after the check, though the
- * dbus structure itself would not be freed (since the dbus object is ref'ed in bus_dbus_impl_new_connection.)
- * Anyway, it'd be better to investigate whether the thread safety issue could cause any real problems. */
+ /* FIXME the check above might not be sufficient. dbus object could be
+ * destroyed in the main thread right after the check, though the
+ * dbus structure itself would not be freed (since the dbus object is
+ * ref'ed in bus_dbus_impl_new_connection.)
+ * Anyway, it'd be better to investigate whether the thread safety issue
+ * could cause any real problems. */
BusForwardData *data = g_slice_new (BusForwardData);
data->message = g_object_ref (message);
data->sender_connection = g_object_ref (connection);
- g_mutex_lock (&dbus->forward_lock);
- gboolean is_running = (dbus->forward_queue != NULL);
- dbus->forward_queue = g_list_append (dbus->forward_queue, data);
- g_mutex_unlock (&dbus->forward_lock);
+ dbus->forward->is_locked = bus_dbus_queue_mutex_safe_lock (
+ dbus->forward, message,
+ __LINE__, G_STRFUNC);
+ gboolean is_running = (dbus->forward->queue != NULL);
+ dbus->forward->queue = g_list_append (dbus->forward->queue, data);
+ dbus->forward->is_locked = bus_dbus_queue_mutex_safe_unlock (
+ dbus->forward, message,
+ __LINE__, G_STRFUNC);
if (!is_running) {
g_idle_add_full (G_PRIORITY_DEFAULT,
@@ -1840,29 +1967,40 @@ bus_dispatch_data_free (BusDispatchData *data)
/**
* bus_dbus_impl_dispatch_message_by_rule_idle_cb:
*
- * Process the first element of the dbus->dispatch_queue.
+ * Process the first element of the dbus->dispatch->queue.
*/
static gboolean
bus_dbus_impl_dispatch_message_by_rule_idle_cb (BusDBusImpl *dbus)
{
- g_return_val_if_fail (dbus->dispatch_queue != NULL, FALSE);
+ g_return_val_if_fail (dbus->dispatch->queue != NULL, FALSE);
if (G_UNLIKELY (IBUS_OBJECT_DESTROYED (dbus))) {
/* dbus was destryed */
- g_mutex_lock (&dbus->dispatch_lock);
- g_list_free_full (dbus->dispatch_queue,
+ BusDispatchData *data = (BusDispatchData *) dbus->dispatch->queue->data;
+ dbus->dispatch->is_locked = bus_dbus_queue_mutex_safe_lock (
+ dbus->dispatch, data->message,
+ __LINE__, G_STRFUNC);
+ g_list_free_full (dbus->dispatch->queue,
(GDestroyNotify) bus_dispatch_data_free);
- dbus->dispatch_queue = NULL;
- g_mutex_unlock (&dbus->dispatch_lock);
- return FALSE; /* return FALSE to prevent this callback to be called again. */
+ dbus->dispatch->queue = NULL;
+ dbus->dispatch->is_locked = bus_dbus_queue_mutex_safe_unlock (
+ dbus->dispatch, data->message,
+ __LINE__, G_STRFUNC);
+ return FALSE;
+ /* return FALSE to prevent this callback to be called again. */
}
/* remove fist node */
- g_mutex_lock (&dbus->dispatch_lock);
- BusDispatchData *data = (BusDispatchData *) dbus->dispatch_queue->data;
- dbus->dispatch_queue = g_list_delete_link (dbus->dispatch_queue, dbus->dispatch_queue);
- gboolean has_message = (dbus->dispatch_queue != NULL);
- g_mutex_unlock (&dbus->dispatch_lock);
+ BusDispatchData *data = (BusDispatchData *) dbus->dispatch->queue->data;
+ dbus->dispatch->is_locked = bus_dbus_queue_mutex_safe_lock (
+ dbus->dispatch, data->message,
+ __LINE__, G_STRFUNC);
+ dbus->dispatch->queue = g_list_delete_link (dbus->dispatch->queue,
+ dbus->dispatch->queue);
+ gboolean has_message = (dbus->dispatch->queue != NULL);
+ dbus->dispatch->is_locked = bus_dbus_queue_mutex_safe_unlock (
+ dbus->dispatch, data->message,
+ __LINE__, G_STRFUNC);
GList *link = NULL;
GList *recipients = NULL;
@@ -1916,11 +2054,15 @@ bus_dbus_impl_dispatch_message_by_rule (BusDBusImpl *dbus,
g_object_set_qdata ((GObject *) message, dispatched_quark, GINT_TO_POINTER (1));
/* append dispatch data into the queue, and start idle task if necessary */
- g_mutex_lock (&dbus->dispatch_lock);
- gboolean is_running = (dbus->dispatch_queue != NULL);
- dbus->dispatch_queue = g_list_append (dbus->dispatch_queue,
+ dbus->dispatch->is_locked = bus_dbus_queue_mutex_safe_lock (
+ dbus->dispatch, message,
+ __LINE__, G_STRFUNC);
+ gboolean is_running = (dbus->dispatch->queue != NULL);
+ dbus->dispatch->queue = g_list_append (dbus->dispatch->queue,
bus_dispatch_data_new (message, skip_connection));
- g_mutex_unlock (&dbus->dispatch_lock);
+ dbus->dispatch->is_locked = bus_dbus_queue_mutex_safe_unlock (
+ dbus->dispatch, message,
+ __LINE__, G_STRFUNC);
if (!is_running) {
g_idle_add_full (G_PRIORITY_DEFAULT,
(GSourceFunc) bus_dbus_impl_dispatch_message_by_rule_idle_cb,
diff --git a/bus/engineproxy.c b/bus/engineproxy.c
index 2d98995c..d661673a 100644
index 2d98995c..2176e0c9 100644
--- a/bus/engineproxy.c
+++ b/bus/engineproxy.c
@@ -665,6 +665,7 @@ bus_engine_proxy_new_internal (const gchar *path,
@ -146,20 +460,24 @@ index 2d98995c..d661673a 100644
"desc", desc,
"g-connection", connection,
"g-interface-name", IBUS_INTERFACE_ENGINE,
@@ -681,6 +682,8 @@ bus_engine_proxy_new_internal (const gchar *path,
@@ -681,6 +682,12 @@ bus_engine_proxy_new_internal (const gchar *path,
"g-default-timeout", g_gdbus_timeout,
"g-flags", flags,
NULL);
+ /* FIXME: rhbz#1601577 */
+ g_assert_no_error (error);
+ if (error) {
+ /* show abrt local variable */
+ gchar *message = g_strdup (error->message);
+ g_error ("%s", message);
+ }
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 ec1caea8..9ae3751b 100644
index bbbb5770..77fcf42f 100644
--- a/bus/ibusimpl.c
+++ b/bus/ibusimpl.c
@@ -484,13 +484,16 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
@@ -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;
@ -177,7 +495,7 @@ index ec1caea8..9ae3751b 100644
if (*panel != NULL) {
ibus_proxy_destroy ((IBusProxy *)(*panel));
@@ -499,9 +502,21 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
@@ -479,9 +482,21 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
g_assert (*panel == NULL);
}
@ -200,7 +518,7 @@ index ec1caea8..9ae3751b 100644
*panel = bus_panel_proxy_new (connection, panel_type);
if (panel_type == PANEL_TYPE_EXTENSION_EMOJI)
ibus->enable_emoji_extension = FALSE;
@@ -555,7 +570,7 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
@@ -535,7 +550,7 @@ _dbus_name_owner_changed_cb (BusDBusImpl *dbus,
}
}
}
@ -210,5 +528,5 @@ index ec1caea8..9ae3751b 100644
bus_ibus_impl_component_name_owner_changed (ibus, name, old_name, new_name);
}
--
2.17.1
2.19.1

View File

@ -2286,3 +2286,517 @@ index ab7ff88a..f9310867 100644
--
2.19.1
From 4ef976a8b934bf76cfd855013b766f6492dc9e8a Mon Sep 17 00:00:00 2001
From: Mathieu Bridon <bochecha@daitauha.fr>
Date: Mon, 7 Jan 2019 21:15:35 +0900
Subject: [PATCH] introspection: Tell the GI scanner to include the C
headers
This adds the following line to the generated gir file:
<c:include name="ibus.h"/>
This is important, for example for Rust bindings generated from the
gtk-rs tooling.
BUG=https://github.com/ibus/ibus/pull/2071
---
configure.ac | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 8fc76239..77823c3c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -315,7 +315,7 @@ GOBJECT_INTROSPECTION_CHECK([0.6.8])
IBUS_GIR_SCANNERFLAGS=
if test x"$found_introspection" = x"yes" ; then
- IBUS_GIR_SCANNERFLAGS="--warn-all --identifier-prefix=IBus --symbol-prefix=ibus"
+ IBUS_GIR_SCANNERFLAGS="--warn-all --identifier-prefix=IBus --symbol-prefix=ibus --c-include=ibus.h"
PKG_CHECK_EXISTS([gobject-introspection-1.0 >= 0.9.6],
[gir_symbol_prefix=yes],
[gir_symbol_prefix=no])
--
2.19.1
From 0fd043c3b4c90855bfb4fceed4bf2f3c3635a041 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 8 Jan 2019 12:02:32 +0900
Subject: [PATCH] portal: Update APIs for Hangul preedit in Flatpak
BUG=https://github.com/ibus/ibus/issues/1980
---
portal/org.freedesktop.IBus.Portal.xml | 9 ++++++++-
portal/portal.c | 18 +++++++++++++++++-
2 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/portal/org.freedesktop.IBus.Portal.xml b/portal/org.freedesktop.IBus.Portal.xml
index afce4daa..376ad424 100644
--- a/portal/org.freedesktop.IBus.Portal.xml
+++ b/portal/org.freedesktop.IBus.Portal.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--
- Copyright (C) 2017 Red Hat, Inc.
+ Copyright (C) 2017-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
@@ -97,6 +97,12 @@
<arg type='u' name='cursor_pos' />
<arg type='b' name='visible' />
</signal>
+ <signal name='UpdatePreeditTextWithMode'>
+ <arg type='v' name='text' />
+ <arg type='u' name='cursor_pos' />
+ <arg type='b' name='visible' />
+ <arg type='u' name='mode' />
+ </signal>
<signal name='ShowPreeditText'/>
<signal name='HidePreeditText'/>
<signal name='UpdateAuxiliaryText'>
@@ -123,6 +129,7 @@
</signal>
<property name='ContentType' type='(uu)' access='write' />
+ <property name='ClientCommitPreedit' type='(b)' access='write' />
</interface>
<interface name='org.freedesktop.IBus.Service'>
diff --git a/portal/portal.c b/portal/portal.c
index cb24d257..e78bc92f 100644
--- a/portal/portal.c
+++ b/portal/portal.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus - The Input Bus
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2017-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
@@ -67,6 +67,7 @@ struct _IBusPortalClass
enum
{
PROP_CONTENT_TYPE = 1,
+ PROP_CLIENT_COMMIT_PREEDIT,
N_PROPERTIES
};
@@ -315,6 +316,20 @@ ibus_portal_context_set_property (IBusPortalContext *portal_context,
NULL /* user_data */
);
break;
+ case PROP_CLIENT_COMMIT_PREEDIT:
+ g_dbus_proxy_call (G_DBUS_PROXY (portal_context->context),
+ "org.freedesktop.DBus.Properties.Set",
+ g_variant_new ("(ssv)",
+ IBUS_INTERFACE_INPUT_CONTEXT,
+ "ClientCommitPreedit",
+ g_value_get_variant (value)),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, /* cancellable */
+ NULL, /* callback */
+ NULL /* user_data */
+ );
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (portal_context, prop_id, pspec);
}
@@ -328,6 +343,7 @@ ibus_portal_context_get_property (IBusPortalContext *portal_context,
{
switch (prop_id) {
case PROP_CONTENT_TYPE:
+ case PROP_CLIENT_COMMIT_PREEDIT:
g_warning ("No support for setting content type");
break;
default:
--
2.19.1
From be7fb813e530442897a9f9130b8a26380e5a12a1 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Tue, 8 Jan 2019 12:02:37 +0900
Subject: [PATCH] client/gtk2: Fix Atom and Slack for Flatpak
Seems Atom, slack, com.visualstudio.code does not enable
gtk_key_snooper_install() and this issue causes to call
gtk_im_context_filter_keypress instead of calling ibus APIs.
BUG=https://github.com/ibus/ibus/issues/1991
---
client/gtk2/ibusimcontext.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/client/gtk2/ibusimcontext.c b/client/gtk2/ibusimcontext.c
index f9310867..264a747a 100644
--- a/client/gtk2/ibusimcontext.c
+++ b/client/gtk2/ibusimcontext.c
@@ -565,6 +565,10 @@ daemon_name_appeared (GDBusConnection *connection,
const gchar *owner,
gpointer data)
{
+ if (!g_strcmp0 (ibus_bus_get_service_name (_bus), IBUS_SERVICE_PORTAL)) {
+ _daemon_is_running = TRUE;
+ return;
+ }
/* If ibus-daemon is running and run ssh -X localhost,
* daemon_name_appeared() is called but ibus_get_address() == NULL
* because the hostname and display number are different between
--
2.19.1
From 0f5084e07c215d74adc4eeeda40b374855cce59a Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 11 Jan 2019 12:56:42 +0900
Subject: [PATCH] src/ibuscomposetable: Replace assert with warning for
.XCompose
BUG=rhbz#1470673
---
src/ibuscomposetable.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c
index b843e7e1..1c0ece41 100644
--- a/src/ibuscomposetable.c
+++ b/src/ibuscomposetable.c
@@ -1,7 +1,7 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* ibus - The Input Bus
* Copyright (C) 2013-2014 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2013-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2013-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -98,14 +98,16 @@ parse_compose_value (IBusComposeData *compose_data,
uch = words[1][1];
/* The escaped string "\"" is separated with '\\' and '"'. */
- if (uch == '\0' && words[2][0] == '"')
+ if (uch == '\0' && words[2][0] == '"') {
uch = '"';
/* The escaped octal */
- else if (uch >= '0' && uch <= '8')
+ } else if (uch >= '0' && uch <= '8') {
uch = g_ascii_strtoll(words[1] + 1, NULL, 8);
/* If we need to handle other escape sequences. */
- else if (uch != '\\')
- g_assert_not_reached ();
+ } else if (uch != '\\') {
+ g_warning ("Invalid backslash: %s: %s", val, line);
+ goto fail;
+ }
}
if (g_utf8_get_char (g_utf8_next_char (words[1])) > 0) {
--
2.19.1
From 9669a812a025e2c6bcac3f2262c6cfed8fff7db4 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 17 Jan 2019 16:12:49 +0900
Subject: [PATCH] Delete weak pointer in GList.SList for vala 0.43.4
Vala 0.43.4 does not allow to convert a weak pointer to the full one in SList.
emojier.vala:424.36-425.73: error: Assignment: Cannot convert from
`GLib.SList<weak IBus.EmojiData>' to `GLib.SList<IBus.EmojiData>?'
emojier.vala:636.9-637.69: error: Assignment: Cannot convert from
`GLib.SList<weak IBus.UnicodeBlock>' to `GLib.SList<IBus.UnicodeBlock>'
panel.vala:526.36-526.65: error: Assignment: Cannot convert from
`GLib.List<weak IBus.EngineDesc>' to `GLib.List<IBus.EngineDesc>?'
---
src/ibusbus.h | 11 ++++++-----
src/ibusemoji.h | 6 +++---
src/ibusunicode.h | 8 ++++----
ui/gtk3/emojier.vala | 24 ++++++++++++++++--------
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/src/ibusbus.h b/src/ibusbus.h
index dff3dfb7..fddcf5b2 100644
--- a/src/ibusbus.h
+++ b/src/ibusbus.h
@@ -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) 2013-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
@@ -692,7 +693,7 @@ gboolean ibus_bus_register_component_async_finish
*
* List engines synchronously.
*
- * Returns: (transfer container) (element-type IBusEngineDesc):
+ * Returns: (transfer full) (element-type IBusEngineDesc):
* A List of engines.
*/
GList *ibus_bus_list_engines (IBusBus *bus);
@@ -725,7 +726,7 @@ void ibus_bus_list_engines_async
*
* Finishes an operation started with ibus_bus_list_engines_async().
*
- * Returns: (transfer container) (element-type IBusEngineDesc):
+ * Returns: (transfer full) (element-type IBusEngineDesc):
* A List of engines.
*/
GList *ibus_bus_list_engines_async_finish
@@ -740,7 +741,7 @@ GList *ibus_bus_list_engines_async_finish
*
* List active engines synchronously.
*
- * Returns: (transfer container) (element-type IBusEngineDesc):
+ * Returns: (transfer full) (element-type IBusEngineDesc):
* A List of active engines.
*
* Deprecated: 1.5.3: Read dconf value
@@ -782,7 +783,7 @@ void ibus_bus_list_active_engines_async
*
* Finishes an operation started with ibus_bus_list_active_engines_async().
*
- * Returns: (transfer container) (element-type IBusEngineDesc):
+ * Returns: (transfer full) (element-type IBusEngineDesc):
* A List of active engines.
*
* Deprecated: 1.5.3: Read dconf value
diff --git a/src/ibusemoji.h b/src/ibusemoji.h
index 4edee726..5e9fbcf4 100644
--- a/src/ibusemoji.h
+++ b/src/ibusemoji.h
@@ -1,8 +1,8 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* bus - The Input Bus
- * Copyright (C) 2017 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2017 Red Hat, Inc.
+ * Copyright (C) 2017-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2017-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
@@ -209,7 +209,7 @@ void ibus_emoji_data_save (const gchar *path,
* ibus_emoji_data_load:
* @path: A path of the saved dictionary file.
*
- * Returns: (element-type IBusEmojiData) (transfer container):
+ * Returns: (element-type IBusEmojiData) (transfer full):
* An #IBusEmojiData list loaded from the saved cache file.
*/
GSList * ibus_emoji_data_load (const gchar *path);
diff --git a/src/ibusunicode.h b/src/ibusunicode.h
index 99de9451..473bdb19 100644
--- a/src/ibusunicode.h
+++ b/src/ibusunicode.h
@@ -1,8 +1,8 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* bus - The Input Bus
- * Copyright (C) 2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
- * Copyright (C) 2018 Red Hat, Inc.
+ * Copyright (C) 2018-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (C) 2018-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
@@ -201,7 +201,7 @@ void ibus_unicode_data_save (const gchar *path,
* #IBusUnicodeData, * the total number of #IBusUnicodeData) of uint values
* with that signal by 100 times. Otherwise %NULL.
*
- * Returns: (element-type IBusUnicodeData) (transfer container):
+ * Returns: (element-type IBusUnicodeData) (transfer full):
* An #IBusUnicodeData list loaded from the saved cache file.
*/
GSList * ibus_unicode_data_load (const gchar *path,
@@ -290,7 +290,7 @@ void ibus_unicode_block_save (const gchar *path,
* ibus_unicode_block_load:
* @path: A path of the saved dictionary file.
*
- * Returns: (element-type IBusUnicodeBlock) (transfer container):
+ * Returns: (element-type IBusUnicodeBlock) (transfer full):
* An #IBusUnicodeBlock list loaded from the saved cache file.
*/
GSList * ibus_unicode_block_load (const gchar *path);
diff --git a/ui/gtk3/emojier.vala b/ui/gtk3/emojier.vala
index 0b9b54a9..aedeb4cb 100644
--- a/ui/gtk3/emojier.vala
+++ b/ui/gtk3/emojier.vala
@@ -2,7 +2,7 @@
*
* ibus - The Input Bus
*
- * Copyright (c) 2017-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
+ * Copyright (c) 2017-2019 Takao Fujiwara <takao.fujiwara1@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -882,8 +882,13 @@ public class IBusEmojier : Gtk.ApplicationWindow {
update_unicode_blocks();
return;
} else {
- unowned GLib.SList<unowned string> emojis =
- m_category_to_emojis_dict.lookup(category);
+ // Use copy_deep() since vala 0.43.4 does not allow to assign
+ // a weak pointer to the full one in SList:
+ // emojier.vala:885.48-886.62: error: Assignment: Cannot convert
+ // from `GLib.SList<string>' to `GLib.SList<weak string>?'
+ GLib.SList<string> emojis =
+ m_category_to_emojis_dict.lookup(category).copy_deep(
+ GLib.strdup);
m_lookup_table.clear();
m_candidate_panel_mode = true;
foreach (unowned string emoji in emojis) {
@@ -1547,8 +1552,8 @@ public class IBusEmojier : Gtk.ApplicationWindow {
m_vbox.add(widget);
widget.show_all();
}
- unowned GLib.SList<unowned string>? annotations =
- data.get_annotations();
+ GLib.SList<string> annotations =
+ data.get_annotations().copy_deep(GLib.strdup);
var buff = new GLib.StringBuilder();
int i = 0;
foreach (unowned string annotation in annotations) {
@@ -2001,17 +2006,20 @@ public class IBusEmojier : Gtk.ApplicationWindow {
) as IBus.EmojiData;
m_emoji_to_data_dict.insert(favorite, new_data);
} else {
- unowned GLib.SList<string> annotations = data.get_annotations();
+ GLib.SList<string> annotations =
+ data.get_annotations().copy_deep(GLib.strdup);
if (annotations.find_custom(annotation, GLib.strcmp) == null) {
annotations.append(annotation);
- data.set_annotations(annotations.copy());
+ data.set_annotations(annotations.copy_deep(GLib.strdup));
}
}
unowned GLib.SList<string> emojis =
m_annotation_to_emojis_dict.lookup(annotation);
if (emojis.find_custom(favorite, GLib.strcmp) == null) {
emojis.append(favorite);
- m_annotation_to_emojis_dict.replace(annotation, emojis.copy());
+ m_annotation_to_emojis_dict.replace(
+ annotation,
+ emojis.copy_deep(GLib.strdup));
}
}
}
--
2.19.1
From 4592ce512fd830e646beec0f7aa21add739bb6fa Mon Sep 17 00:00:00 2001
From: bmansurov <45986298+bmansurov@users.noreply.github.com>
Date: Tue, 29 Jan 2019 18:02:04 +0900
Subject: [PATCH] engine: Add Uzbek layouts
BUG=https://github.com/ibus/ibus/pull/2069
---
engine/simple.xml.in | 83 +++++++++++++++++++++++++++++++-------------
1 file changed, 59 insertions(+), 24 deletions(-)
diff --git a/engine/simple.xml.in b/engine/simple.xml.in
index f35d7a58..4445c254 100644
--- a/engine/simple.xml.in
+++ b/engine/simple.xml.in
@@ -680,32 +680,67 @@
<longname>Ukrainian</longname>
<description>Ukrainian</description>
<icon>ibus-keyboard</icon>
- <rank>99</rank>
- </engine>
- <engine>
- <name>xkb:gb:extd:eng</name>
- <language>en</language>
- <license>GPL</license>
- <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
- <layout>gb</layout>
- <layout_variant>extd</layout_variant>
- <longname>English (UK, extended WinKeys)</longname>
- <description>English (UK, extended WinKeys)</description>
+ <rank>99</rank>
+ </engine>
+ <engine>
+ <name>xkb:uz::uzb</name>
+ <language>uz</language>
+ <license>GPL</license>
+ <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
+ <layout>uz</layout>
+ <longname>Uzbek</longname>
+ <description>Uzbek</description>
<icon>ibus-keyboard</icon>
- <rank>1</rank>
- </engine>
- <engine>
- <name>xkb:gb:dvorak:eng</name>
- <language>en</language>
- <license>GPL</license>
- <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
- <layout>gb</layout>
- <layout_variant>dvorak</layout_variant>
- <longname>English (UK, Dvorak)</longname>
- <description>English (UK, Dvorak)</description>
+ <rank>99</rank>
+ </engine>
+ <engine>
+ <name>xkb:uz:cyrillic:uzb</name>
+ <language>uz</language>
+ <license>GPL</license>
+ <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
+ <layout>uz</layout>
+ <layout_variant>cyrillic</layout_variant>
+ <longname>Uzbek Cyrillic</longname>
+ <description>Uzbek Cyrillic</description>
<icon>ibus-keyboard</icon>
- <rank>1</rank>
- </engine>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>xkb:uz:latin:uzb</name>
+ <language>uz</language>
+ <license>GPL</license>
+ <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
+ <layout>uz</layout>
+ <layout_variant>latin</layout_variant>
+ <longname>Uzbek Latin</longname>
+ <description>Uzbek Latin</description>
+ <icon>ibus-keyboard</icon>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>xkb:gb:extd:eng</name>
+ <language>en</language>
+ <license>GPL</license>
+ <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
+ <layout>gb</layout>
+ <layout_variant>extd</layout_variant>
+ <longname>English (UK, extended WinKeys)</longname>
+ <description>English (UK, extended WinKeys)</description>
+ <icon>ibus-keyboard</icon>
+ <rank>1</rank>
+ </engine>
+ <engine>
+ <name>xkb:gb:dvorak:eng</name>
+ <language>en</language>
+ <license>GPL</license>
+ <author>Peng Huang &lt;shawn.p.huang@gmail.com&gt;</author>
+ <layout>gb</layout>
+ <layout_variant>dvorak</layout_variant>
+ <longname>English (UK, Dvorak)</longname>
+ <description>English (UK, Dvorak)</description>
+ <icon>ibus-keyboard</icon>
+ <rank>1</rank>
+ </engine>
<engine>
<name>xkb:my::msa</name>
<language>ms</language>
--
2.19.1

View File

@ -35,7 +35,7 @@
Name: ibus
Version: 1.5.19
Release: 12%{?dist}
Release: 13%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -426,6 +426,12 @@ dconf update || :
%{_datadir}/gtk-doc/html/*
%changelog
* Tue Jan 29 2019 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.19-13
- Resolves: #1470673 Replace assert with warning for .XCompose
- Update APIs for Hangul preedit in Flatpak
- Fix Atom and Slack for Flatpak
- Resolves: #1663528 Check if the mutex is not unlocked before the clear
* Thu Dec 20 2018 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.19-12
- Use ISO 639-3 names instead of 639
- Connect to button-press-event only with IBUS_ENGINE_PREEDIT_COMMIT