fix crash if image creation has errors

(cherry picked from commit 14c996a4928960834c08b6abb3538e9ac9a42a99)
This commit is contained in:
yanshuai01 2024-05-11 10:48:00 +08:00 committed by openeuler-sync-bot
parent 661f63fd59
commit d29f7b8fd3
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,40 @@
From 20f55290ca0f97925935467e8ddc8f80e19ec5ab Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Wed, 29 Nov 2023 17:44:54 +0100
Subject: [PATCH] creatediskimage: Fix crash if image creation has errors
The change to use the dialogue "response" signal made the code release
the last reference to the DialogData before the user could answer, and
when they did, we would crash trying to access it.
Fixes: 6ef5a055debd ("creatediskimage: Use dialog response signal")
Closes: #319
---
src/disks/gducreatediskimagedialog.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/disks/gducreatediskimagedialog.c b/src/disks/gducreatediskimagedialog.c
index 5f64c81..5d5a4d9 100644
--- a/src/disks/gducreatediskimagedialog.c
+++ b/src/disks/gducreatediskimagedialog.c
@@ -466,6 +466,7 @@ on_response (GtkDialog *dialog,
g_clear_error (&error);
}
}
+ dialog_data_unref (data);
}
static gboolean
@@ -514,7 +515,7 @@ on_success (gpointer user_data)
GTK_RESPONSE_NO);
gtk_dialog_add_button (GTK_DIALOG (dialog), _("_Close"), GTK_RESPONSE_CLOSE);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE);
- g_signal_connect (dialog, "response", G_CALLBACK (on_response), data);
+ g_signal_connect (dialog, "response", G_CALLBACK (on_response), dialog_data_ref (data));
g_free (s);
gtk_window_present (GTK_WINDOW (dialog));
--
2.27.0

View File

@ -2,7 +2,7 @@
Name: gnome-disk-utility
Version: 44.0
Release: 1
Release: 2
Summary: Libraries and applications for dealing with storage devices
License: GPLv2+
URL: https://gitlab.gnome.org/GNOME/gnome-disk-utility
@ -19,6 +19,7 @@ Requires: udisks2
Requires: libhandy%{?_isa} >= %{libhandy_version}
Patch1: 0001-fix-disks-Fixed-interface-translation-not-displayed.patch
Patch2: 0002-fix-crash-if-image-creation-has-errors.patch
%description
This gnome-disk-utility repository provides libraries and applications for
@ -58,6 +59,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop
%{_mandir}/man1/*
%changelog
* Sat May 11 2024 yanshuai <yanshuai@kylinos.cn> - 44.0-2
- creatediskimage: Fix crash if image creation has errors
* Thu Nov 23 2023 lwg <liweiganga@uniontech.com> - 44.0-1
- update to version 44.0