!10 Fix crash if image creation has errors

From: @yanyan11222 
Reviewed-by: @open-bot 
Signed-off-by: @open-bot
This commit is contained in:
openeuler-ci-bot 2024-05-11 03:35:06 +00:00 committed by Gitee
commit fe79a3bb4f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
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