From cf30db6d19fd0d3c46a5468b34c53a2b7ba5d3b6 Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Wed, 15 May 2024 23:30:59 +0900 Subject: [PATCH] src/tests: Fix ibus-daemon in ibus-desktop-testing-runner Some distributions do not need the IBus panel and gnome-shell also does not need it. Add --verbose option to get ibus-daemon error messages. --- src/tests/ibus-desktop-testing-runner.in | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in index 6b208345..1ac2dfc8 100755 --- a/src/tests/ibus-desktop-testing-runner.in +++ b/src/tests/ibus-desktop-testing-runner.in @@ -45,6 +45,7 @@ TEST_LOG_STDOUT=0 RESULT_LOG="" SCREEN_LOG="" HAVE_GRAPHICS=1 +VERBOSE=0 DESKTOP_COMMAND="dbus-launch --exit-with-session gnome-session" PID_XORG=0 PID_GNOME_SESSION=0 @@ -83,6 +84,7 @@ usage() "-b, --builddir=BUILDDIR Set the BUILDDIR\n" \ "-s, --srcdir=SOURCEDIR Set the SOURCEDIR\n" \ "-c, --no-graphics Use Xvfb instead of Xorg\n" \ +"-V, --verbose Verbose log for ibus-daemon\n" \ "-d, --desktop=DESKTOP Run DESTKTOP. The default is gnome-session.\n" \ " Suffix '-with-dbus' can run DESKTOP with dbus session." \ " E.g. --desktop=mutter-with-dbus" \ @@ -101,8 +103,8 @@ usage() parse_args() { # This is GNU getopt. "sudo port getopt" in BSD? - ARGS=`getopt -o hvb:s:cd:t:r:T:o:O:S: --long \ - help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,timeout:,output:,result:,screendump:\ + ARGS=`getopt -o hvb:s:cVd:t:r:T:o:O:S: --long \ + help,version,builddir:,srcdir:,no-graphics,verbose,desktop:,tests:,runner:,timeout:,output:,result:,screendump:\ -- "$@"`; eval set -- "$ARGS" while [ 1 ] ; do @@ -112,6 +114,7 @@ parse_args() -b | --builddir ) BUILDDIR="$2"; shift 2;; -s | --srcdir ) SRCDIR="$2"; shift 2;; -c | --no-graphics ) HAVE_GRAPHICS=0; shift;; + -V | --verbose ) VERBOSE=1; shift;; -d | --desktop ) DESKTOP_COMMAND="$2"; shift 2;; -t | --tests ) TESTS="$2"; shift 2;; -r | --runner ) TESTING_RUNNER="$2"; shift 2;; @@ -286,6 +289,7 @@ run_desktop() PID_GNOME_SESSION=$! sleep 30 + IBUS_ARGS="--verbose --panel disable" # gnome-shell 42 checks if org.freedesktop.IBus.session.GNOME.service # systemd file is available with org.freedesktop.systemd1.Manager.GetUnit # D-Bus method, which is provided by IBus 1.5.26, and if the file @@ -302,8 +306,15 @@ run_desktop() # with gnome-session.target systemd file. # But `systemctl start gdm` terminates the parent script forcibly # and the script cannot get the CI result. - ibus-daemon --daemonize --verbose + if test $VERBOSE -eq 1 ; then + ibus-daemon $IBUS_ARGS & + else + ibus-daemon $IBUS_ARGS --daemonize + fi sleep 3 + if test $VERBOSE -eq 1 ; then + ps -ef | grep ibus + fi } -- 2.45.0 From a1a2fe5d13ad76956a94c0695af15d76e3edfdca Mon Sep 17 00:00:00 2001 From: fujiwarat Date: Thu, 18 Jul 2024 01:25:41 +0900 Subject: [PATCH] Fix memory leaks in error handlings - bus/ibusimpl: Free keys not in case of TYPE_IME_SWITCHER - src/ibuscomposetable: Correct handling G_MAXSIZE * G_MAXSIZE - src/ibuscomposetable: Fee ibus_compose_seqs in error handlings --- bus/ibusimpl.c | 3 ++- src/ibuscomposetable.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bus/ibusimpl.c b/bus/ibusimpl.c index 31a095f3..445c062b 100644 --- a/bus/ibusimpl.c +++ b/bus/ibusimpl.c @@ -1986,7 +1986,8 @@ _ibus_set_global_shortcut_keys (BusIBusImpl *ibus, } ibus->ime_switcher_keys = keys; break; - default:; + default: + g_slice_free1 (sizeof (IBusProcessKeyEventData) * (size + 1), keys); } return TRUE; } diff --git a/src/ibuscomposetable.c b/src/ibuscomposetable.c index 7531a4b2..a8e41a33 100644 --- a/src/ibuscomposetable.c +++ b/src/ibuscomposetable.c @@ -849,7 +849,7 @@ compose_data_to_variant (gconstpointer compose_data, g_assert (compose_data); if (error) *error = NULL; - if ((index_stride * n_seqs) > G_MAXUINT64) { + if (n_seqs == 0 || index_stride > (G_MAXSIZE / n_seqs)) { if (error) { g_set_error (error, IBUS_ERROR, IBUS_ERROR_FAILED, "Length %u x %lu is too long", @@ -1404,6 +1404,7 @@ ibus_compose_table_new_with_list (GList *compose_list, (G_MAXSIZE / sizeof (guint16)))) { g_warning ("Too long allocation %lu x %u", s_size_total - s_size_16bit, n_index_stride); + g_free (ibus_compose_seqs); return NULL; } rawdata = (gpointer)g_new ( @@ -1416,6 +1417,8 @@ ibus_compose_table_new_with_list (GList *compose_list, s_size_total - s_size_16bit, n_index_stride, v_size_32bit); + g_free (ibus_compose_seqs); + g_free (rawdata); return NULL; } if (G_LIKELY (rawdata)) { @@ -1432,6 +1435,7 @@ ibus_compose_table_new_with_list (GList *compose_list, } if (!ibus_compose_seqs_32bit_first || !ibus_compose_seqs_32bit_second) { g_warning ("Failed g_new"); + g_free (ibus_compose_seqs); g_free (rawdata); return NULL; } -- 2.45.0