public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Takao Fujiwara <tfujiwar@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/ibus] rawhide: Fix IBusAttrList leak when converting text
Date: Sun, 30 Aug 2026 15:27:48 GMT [thread overview]
Message-ID: <178810366885.1.9307244012343632768.rpms-ibus-32c8d67c8f1f@fedoraproject.org> (raw)
A new commit has been pushed.
Repo : rpms/ibus
Branch : rawhide
Commit : 32c8d67c8f1f30c17f352f805cad7166f3e7459d
Author : Takao Fujiwara <tfujiwar@redhat.com>
Date : 2026-08-31T00:24:35+09:00
Stats : +123/-2 in 3 file(s)
URL : https://src.fedoraproject.org/rpms/ibus/c/32c8d67c8f1f30c17f352f805cad7166f3e7459d?branch=rawhide
Log:
Fix IBusAttrList leak when converting text
Also update CI timeout to 30min.
---
diff --git a/ibus-HEAD.patch b/ibus-HEAD.patch
index e69de29..6054b2f 100644
--- a/ibus-HEAD.patch
+++ b/ibus-HEAD.patch
@@ -0,0 +1,117 @@
+From 1a331e695d84fc6bae8f2d11c52d4776df49647b Mon Sep 17 00:00:00 2001
+From: Sebastian Keller <skeller@gnome.org>
+Date: Thu, 27 Aug 2026 21:07:58 +0200
+Subject: [PATCH] src: Fix IBusAttrList leak when converting text
+
+After 5bbe88a1 the attribute list set on the text was getting leaked
+when the list passed to `ibus_attr_list_copy_format_to_*()` had a length
+of 0. In that case the list is already non-floating before the copy
+function adds a ref and returns it. This then is passed to
+`ibus_text_set_attributes()` which calls `g_object_ref_sink()`. Since
+the list is not floating, this adds another ref that would not be added
+in the length > 0 case. This surplus ref is causing the list to be
+leaked.
+
+To fix this leak we need to unref the list after calling
+`ibus_text_set_attributes()`.
+
+However in the length > 0 case the new list returned by
+`ibus_attr_list_copy_format_to_*()` is floating, so this would drop the
+refcount to 0. To avoid this we need to ensure that if the list is floating the
+floating ref is sunk before calling `ibus_text_set_attributes()`, so the
+call to `g_object_ref_sink()` in there adds a ref, such that we can
+safely unref this after the call to `ibus_text_set_attributes()`.
+
+This also keeps the guarantee that the list is not floating anymore
+after converting text to not regress the issue fixed by 5bbe88a1.
+
+Fixes: https://github.com/ibus/ibus/commit/5bbe88a1
+Closes: https://github.com/ibus/ibus/issues/2941
+---
+ src/ibusinputcontext.c | 20 ++++++++++++++++++--
+ src/ibuspanelservice.c | 20 ++++++++++++++++++--
+ 2 files changed, 36 insertions(+), 4 deletions(-)
+
+diff --git a/src/ibusinputcontext.c b/src/ibusinputcontext.c
+index bdfd166d..d0e162fc 100644
+--- a/src/ibusinputcontext.c
++++ b/src/ibusinputcontext.c
+@@ -569,8 +569,16 @@ ibus_input_context_convert_text (IBusInputContext *context,
+ text->text, error->message);
+ g_error_free (error);
+ }
+- if (new_attrs)
++ if (new_attrs) {
++#if GLIB_CHECK_VERSION (2, 70, 0)
++ g_object_take_ref (new_attrs);
++#else
++ if (g_object_is_floating (new_attrs)
++ g_object_ref_sink (new_attrs);
++#endif
+ ibus_text_set_attributes (text, new_attrs);
++ g_object_unref (new_attrs);
++ }
+ break;
+ case IBUS_PREEDIT_FORMAT_HINT:
+ new_attrs = ibus_attr_list_copy_format_to_hint (text->attrs, &error);
+@@ -579,8 +587,16 @@ ibus_input_context_convert_text (IBusInputContext *context,
+ text->text, error->message);
+ g_error_free (error);
+ }
+- if (new_attrs)
++ if (new_attrs) {
++#if GLIB_CHECK_VERSION (2, 70, 0)
++ g_object_take_ref (new_attrs);
++#else
++ if (g_object_is_floating (new_attrs)
++ g_object_ref_sink (new_attrs);
++#endif
+ ibus_text_set_attributes (text, new_attrs);
++ g_object_unref (new_attrs);
++ }
+ break;
+ default:
+ g_assert_not_reached ();
+diff --git a/src/ibuspanelservice.c b/src/ibuspanelservice.c
+index 14cca3ec..18404a39 100644
+--- a/src/ibuspanelservice.c
++++ b/src/ibuspanelservice.c
+@@ -1203,8 +1203,16 @@ ibus_panel_convert_text (IBusPanelService *panel,
+ text->text, error->message);
+ g_error_free (error);
+ }
+- if (new_attrs)
++ if (new_attrs) {
++#if GLIB_CHECK_VERSION (2, 70, 0)
++ g_object_take_ref (new_attrs);
++#else
++ if (g_object_is_floating (new_attrs)
++ g_object_ref_sink (new_attrs);
++#endif
+ ibus_text_set_attributes (text, new_attrs);
++ g_object_unref (new_attrs);
++ }
+ break;
+ case IBUS_PREEDIT_FORMAT_HINT:
+ new_attrs = ibus_attr_list_copy_format_to_hint (text->attrs, &error);
+@@ -1213,8 +1221,16 @@ ibus_panel_convert_text (IBusPanelService *panel,
+ text->text, error->message);
+ g_error_free (error);
+ }
+- if (new_attrs)
++ if (new_attrs) {
++#if GLIB_CHECK_VERSION (2, 70, 0)
++ g_object_take_ref (new_attrs);
++#else
++ if (g_object_is_floating (new_attrs)
++ g_object_ref_sink (new_attrs);
++#endif
+ ibus_text_set_attributes (text, new_attrs);
++ g_object_unref (new_attrs);
++ }
+ break;
+ default:
+ g_assert_not_reached ();
+--
+2.55.0
+
diff --git a/ibus.spec b/ibus.spec
index 7985f97..78f5f73 100644
--- a/ibus.spec
+++ b/ibus.spec
@@ -48,7 +48,7 @@
Name: ibus
Version: 1.5.35~beta2
# https://github.com/fedora-infra/rpmautospec/issues/101
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPL-2.1-or-later
URL: https://github.com/ibus/%name/wiki
@@ -57,6 +57,7 @@ Source1: https://github.com/ibus/%name/releases/download/%{source_version
Source2: %{name}-xinput
Source3: %{name}.conf.5
# Patch: %%{name}-HEAD.patch
+Patch: %{name}-HEAD.patch
# Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577
Patch: %{name}-1385349-segv-bus-proxy.patch
@@ -548,6 +549,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
+* Sun Aug 30 2026 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.35~beta2-2
+- Fix IBusAttrList leak when converting text
+
* Wed Aug 26 2026 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.35~beta2-1
- Fix match rules in ibus-daemon
- Update meson builds
diff --git a/tests/ibus-desktop-testing/run/main.fmf b/tests/ibus-desktop-testing/run/main.fmf
index d2434b1..10358f5 100644
--- a/tests/ibus-desktop-testing/run/main.fmf
+++ b/tests/ibus-desktop-testing/run/main.fmf
@@ -1,5 +1,5 @@
summary: Run tests
description:
Run CI with ibus-desktop-testing-runner in GNOME Wayland.
-duration: 15m
+duration: 30m
test: ./test.sh
reply other threads:[~2026-08-30 15:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=178810366885.1.9307244012343632768.rpms-ibus-32c8d67c8f1f@fedoraproject.org \
--to=tfujiwar@redhat.com \
--cc=git-commits@fedoraproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox