From e68edb42ac197b049102d6ecd3d8d8eaa143a874 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 20 Apr 2023 11:38:18 -0700 Subject: [PATCH] - Backport MR #25 for crash when --no-cancel and/or --auto-close are used (#2177287) --- ...t-update-responses-that-aren-t-there.patch | 71 +++++++++++++++++++ zenity.spec | 10 ++- 2 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 0001-progress-don-t-update-responses-that-aren-t-there.patch diff --git a/0001-progress-don-t-update-responses-that-aren-t-there.patch b/0001-progress-don-t-update-responses-that-aren-t-there.patch new file mode 100644 index 0000000..d6983d7 --- /dev/null +++ b/0001-progress-don-t-update-responses-that-aren-t-there.patch @@ -0,0 +1,71 @@ +From debaf6de1bfcd71d403e252caa639c52d2cba6e3 Mon Sep 17 00:00:00 2001 +From: Adam Williamson +Date: Thu, 20 Apr 2023 09:38:28 -0700 +Subject: [PATCH] progress: don't update responses that aren't there + +zenity_progress_handle_stdin always tries to update these +responses when progress seems to be done, but sometimes the +responses aren't present at all. The cancel response is not +present if `no_cancel` is true (that's when the CLI param +`--no-cancel` is used), and the OK response is not present if +`auto_close` is true (that's when `--auto-close` is used). We +need to only update the responses when they're present. This +solves a problem where zenity will print some errors then crash +when `--no-cancel` or `--auto-close` (or both) are used, notably +by Steam: + +zenity[3319]: adw_message_dialog_set_response_enabled: assertion 'adw_message_dialog_has_response (self, response)' failed +zenity[3319]: adw_message_dialog_set_response_enabled: assertion 'adw_message_dialog_has_response (self, response)' failed +zenity[3319]: adw_message_dialog_set_response_enabled: assertion 'adw_message_dialog_has_response (self, response)' failed +steam.desktop[3319]: ** +steam.desktop[3319]: Zenity:ERROR:../src/util.c:465:zenity_util_gapp_quit: assertion failed: (GTK_IS_WINDOW (window)) +steam.desktop[3319]: Bail out! Zenity:ERROR:../src/util.c:465:zenity_util_gapp_quit: assertion failed: (GTK_IS_WINDOW (window)) + +I don't know why this causes the parent to stop being a window, +but...apparently it does. See: + +https://bugzilla.redhat.com/show_bug.cgi?id=2177287 + +Signed-off-by: Adam Williamson +--- + src/progress.c | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/src/progress.c b/src/progress.c +index cae1a6c3..507c4c58 100644 +--- a/src/progress.c ++++ b/src/progress.c +@@ -249,8 +249,11 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition, + + if (percentage == 100) + { +- adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE); +- adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok"); ++ if (!auto_close) ++ { ++ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE); ++ adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok"); ++ } + + if (progress_data->autoclose) + { +@@ -271,9 +274,13 @@ zenity_progress_handle_stdin (GIOChannel *channel, GIOCondition condition, + { + /* We assume that we are done, so stop the pulsating and de-sensitize + * the buttons */ +- adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE); +- adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "cancel", FALSE); +- adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok"); ++ if (!no_cancel) ++ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "cancel", FALSE); ++ if (!auto_close) ++ { ++ adw_message_dialog_set_response_enabled (ADW_MESSAGE_DIALOG(parent), "ok", TRUE); ++ adw_message_dialog_set_default_response (ADW_MESSAGE_DIALOG(parent), "ok"); ++ } + + gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress_bar), 1.0); + +-- +2.40.0 + diff --git a/zenity.spec b/zenity.spec index b2c3168..c3caf07 100644 --- a/zenity.spec +++ b/zenity.spec @@ -1,11 +1,16 @@ Name: zenity Version: 3.91.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Display dialog boxes from shell scripts License: LGPL-2.1-or-later URL: https://wiki.gnome.org/Projects/Zenity Source: https://download.gnome.org/sources/%{name}/3.91/%{name}-%{version}.tar.xz +# https://bugzilla.redhat.com/show_bug.cgi?id=2177287 +# https://gitlab.gnome.org/GNOME/zenity/-/merge_requests/25 +# Fix crash caused by trying to set responses that aren't there +# when --no-cancel and/or --auto-close are used +Patch0: 0001-progress-don-t-update-responses-that-aren-t-there.patch BuildRequires: pkgconfig(libadwaita-1) >= 1.2 BuildRequires: /usr/bin/help2man @@ -54,6 +59,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.Zenity.desk %changelog +* Thu Apr 20 2023 Adam Williamson - 3.91.0-2 +- Backport MR #25 for crash when --no-cancel and/or --auto-close are used (#2177287) + * Tue Mar 07 2023 David King - 3.91.0-1 - Update to 3.91.0