From 2182b099c16e77a251cf7b4d750175c122ffb09c Mon Sep 17 00:00:00 2001 From: lichenggang Date: Mon, 14 Sep 2026 18:34:20 +0800 Subject: [PATCH] fix: avoid icon theme init when GTK is not initialized MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backport upstream commit fab47760d3aa ("I#571 - libedataserverui: Avoid initializing the icon_theme when building introspection data") so that evolution-data-server 3.50.1 builds against GTK 4.18. GTK 4.18 made gdk_display_manager_get() call gdk_ensure_initialized() internally, so calling it before gtk_init() now aborts the process: Gdk-ERROR **: gdk_display_manager_get() was called before gtk_init() _libedataserverui_init_icon_theme() is called from the class_init() of ECredentialsPrompterImplPassword, which g-ir-scanner triggers while dumping type information. Generating EDataServerUI4-1.0.gir therefore killed the introspection helper with SIGTRAP and the build failed at 76% (shuttle task 596422, amd64 and aarch64 alike), while the GTK3 EDataServerUI-1.2 gir was generated fine in the same run. Guard the call with gtk_is_initialized(), which is available since GTK 4.4 (the minimum version required by configure). At runtime the function is only reached with GTK already initialized, so the guard only skips the initialization during introspection/documentation builds. Log: Fixed the GTK 4.18 build failure of EDataServerUI4-1.0.gir Influence: 1. Rebuild the package and confirm EDataServerUI4-1.0.gir is generated 2. Verify libedataserverui4 and its credentials prompter work in evolution with GTK 4.18 3. Check that certificate trust prompts still pick up the bundled icons 4. Ensure no regression on GTK 3 builds of libedataserverui 5. Confirm the package still builds on architectures with older GTK fix: GTK 未初始化时跳过 icon theme 初始化 backport 上游提交 fab47760d3aa("I#571 - libedataserverui: Avoid initializing the icon_theme when building introspection data"),使 evolution-data-server 3.50.1 能在 GTK 4.18 下构建。 GTK 4.18 给 gdk_display_manager_get() 内部加了 gdk_ensure_initialized(), 未先 gtk_init() 就调用会直接致命退出: Gdk-ERROR **: gdk_display_manager_get() was called before gtk_init() _libedataserverui_init_icon_theme() 由 ECredentialsPrompterImplPassword 的 class_init() 调用,而 g-ir-scanner 在 dump 类型信息时会触发 class_init, 于是生成 EDataServerUI4-1.0.gir 时辅助程序死于 SIGTRAP,构建在 76% 处 失败(shuttle 任务 596422,amd64 与 aarch64 均如此),而同一次构建里 GTK3 的 EDataServerUI-1.2 gir 正常生成。 用 gtk_is_initialized() 守卫该调用(自 GTK 4.4 起提供,正是 configure 要求的最低版本)。运行时该函数只会在 GTK 已初始化后进入,因此该守卫 只影响 introspection 与文档构建,不改变既有行为。 Log: 修复 GTK 4.18 下 EDataServerUI4-1.0.gir 生成失败导致的构建中断 Influence: 1. 重新构建软件包,确认 EDataServerUI4-1.0.gir 正常生成 2. 在 GTK 4.18 下验证 libedataserverui4 及其凭据提示框在 evolution 中正常 3. 检查证书信任提示仍能加载随包提供的图标 4. 确保 GTK 3 版 libedataserverui 构建无回归 5. 确认在 GTK 版本较旧的架构上仍能正常构建 repo: evolution-data-server #master --- debian/changelog | 10 +++ ...bedataserverui-gtk4-18-introspection.patch | 67 +++++++++++++++++++ debian/patches/series | 1 + 3 files changed, 78 insertions(+) create mode 100644 debian/patches/libedataserverui-gtk4-18-introspection.patch diff --git a/debian/changelog b/debian/changelog index f738678..8d4ff82 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +evolution-data-server (3.50.1-1deepin1) unstable; urgency=medium + + * Add libedataserverui-gtk4-18-introspection.patch + - Skip the icon theme initialization when GTK is not initialized, so + generating EDataServerUI4-1.0.gir no longer aborts with GTK 4.18 + ("gdk_display_manager_get() was called before gtk_init()") + - Backport of upstream commit fab47760d3aa (GNOME issue #571) + + -- lichenggang Mon, 14 Sep 2026 18:32:50 +0800 + evolution-data-server (3.50.1-1) unstable; urgency=medium * Team upload diff --git a/debian/patches/libedataserverui-gtk4-18-introspection.patch b/debian/patches/libedataserverui-gtk4-18-introspection.patch new file mode 100644 index 0000000..1dfeac4 --- /dev/null +++ b/debian/patches/libedataserverui-gtk4-18-introspection.patch @@ -0,0 +1,67 @@ +From: Jordan Petridis +Date: Mon, 11 Nov 2024 17:26:11 +0000 +Subject: libedataserverui: Avoid initializing the icon_theme when building + introspection data +Bug: https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/571 +Origin: upstream, https://gitlab.gnome.org/GNOME/evolution-data-server/-/commit/fab47760d3aa2b5d4f7aa878e0405e4327a5c188 +Applied-upstream: master, commit fab47760d3aa2b5d4f7aa878e0405e4327a5c188 + +Backport of upstream commit fab47760d3aa for 3.50.1. The original commit +message follows: + + I#571 - libedataserverui: Avoid initializing the icon_theme when building + introspection data + + When we are trying to generate the gobject-introspection data, + _libedataserverui_init_icon_theme will try to create a display without + gtk having been initialized before hand. + + Add a gtk_init_check and assume that we will only run into this when + building and not at runtime. + + Closes https://gitlab.gnome.org/GNOME/evolution-data-server/-/issues/571 + +GTK 4.18 made this fatal: gdk_display_manager_get() now calls +gdk_ensure_initialized() internally and aborts with + + Gdk-ERROR **: gdk_display_manager_get() was called before gtk_init() + +when GTK is not initialized (GTK 4.16 and older created the display +manager unconditionally, so this was harmless there). + +_libedataserverui_init_icon_theme() is called from the class_init() of +ECredentialsPrompterImplPassword, which g-ir-scanner triggers while +dumping type information, so generating EDataServerUI4-1.0.gir aborts +the introspection helper with SIGTRAP and the package build fails with +GTK 4.18: + + [ 76%] Generating EDataServerUI4-1.0.gir + (process:28335): Gdk-ERROR **: gdk_display_manager_get() was called before gtk_init() + make[3]: *** [.../EDataServerUI4-1.0.gir] Error 1 + +gtk_is_initialized() is available since GTK 4.4, which is the minimum +version required by configure, so the guard is safe for all supported +GTK 4 versions. +--- + src/libedataserverui/libedataserverui-private.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/libedataserverui/libedataserverui-private.c b/src/libedataserverui/libedataserverui-private.c +index b4dfb51..201652b 100644 +--- a/src/libedataserverui/libedataserverui-private.c ++++ b/src/libedataserverui/libedataserverui-private.c +@@ -62,6 +62,14 @@ _libedataserverui_init_icon_theme (void) + static gboolean icons_added = FALSE; + + #if GTK_CHECK_VERSION(4, 0, 0) ++ /* We can't call gdk_display_manager_get if gtk is ++ * not initialized. This can happen when we are building ++ * gobject-introspection data or documentation */ ++ if (!gtk_is_initialized ()) { ++ e_source_registry_debug_print ("%s: GTK is not initialized, skipping\n", G_STRFUNC); ++ return; ++ } ++ + if (!icons_added) { + GdkDisplayManager *manager; + diff --git a/debian/patches/series b/debian/patches/series index 0235eac..1c4841d 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,2 +1,3 @@ 01-noinst-libedbus-private.patch ubuntu_gettext_domain.patch +libedataserverui-gtk4-18-introspection.patch